Daipayan Sarkar February 2016
Unable to add record. Joinkey of table not in recordset?MS Acess 2007
I have been trying to have a form where I can enter all my patient details along with the medicines prescribed. I have created 5 tables for this.
- tblpatients for patient details with Patient ID as primary.
- tblvisit for visit details like visitdt,tests,etc, with Visit_ID as primary.
- tblmedicines for list of medicines(which I can add dynamically).
- tblqnty for specific doses and qnty mentioned during a specific visit.
I have created a form with all patient and visit info and a subform inside the form with medicines and qnty(in tabular form).
Now I am facing 2 issues:
I am unable to set the subform to blank by default on load the mainform as new record. I have tried that even on subform but not working.
While trying to add a record in the subform I receive the error message
"Unable to add record. Joinkey of table tbkqnty not in recordset?"
This is killing me .Any help will be appreciated.
Data entry Form and subform
Cisco February 2016
1) If with 'blank' you mean 'empty': look at point 2)
2) In the recordset of your subform you MUST have the field Visit_ID.
If you don't want to show it in the subform set it to
3) Link the two forms (main- and sub-) with
Link Master Field and
Link Child Field in the Main form 'Data' Property Sheet TAB.
4) In the subform, in the
before_Update event set
Sub Form_BeforeUpdate(Cancel As Integer)
Visit_ID = Me.Parent!Visit_ID
(supposed that Control Names are equal to the Field Names).
This will ensure that all records in the child table
related to one record in the table
Hope this helps.
Asked in February 2016
Viewed 3,141 times
Answered 1 times
Leave an answer
Quote of the day: live life