vba - Unable to add record. Joinkey of table not in recordset?MS Acess 2007 -


i have been trying have form can enter patient details along medicines prescribed. have created 5 tables this.

  • tblpatients patient details patient id primary.
  • tblvisit visit details visitdt,tests,etc, visit_id primary.
  • tblmedicines list of medicines(which can add dynamically).
  • tblqnty specific doses , qnty mentioned during specific visit.

i have created form patient , visit info , subform inside form medicines , qnty(in tabular form).

now facing 2 issues:

  1. i unable set subform blank default on load mainform new record. have tried on subform not working.

  2. while trying add record in subform receive error message "unable add record. joinkey of table tbkqnty not in recordset?"

database relationship data entry form , subform

1) if 'blank' mean 'empty': @ point 2)

2) in recordset of subform must have field visit_id. if don't want show in subform set visible: no

3) link 2 forms (main- , sub-) visit_id (table tblvisit) link master field , visit_id (table tblmedicines) link child field in main form 'data' property sheet tab.

4) in subform, in before_update event set

sub form_beforeupdate(cancel integer)     visit_id = me.parent!visit_id  end sub 

(supposed control names equal field names).

this ensure records in child table tblmedicines related 1 record in table tblvisit.

hope helps.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -