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:
i unable set subform blank default on load mainform new record. have tried on subform not working.
while trying add record in subform receive error message "unable add record. joinkey of table tbkqnty not in recordset?"
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
Post a Comment