I have a database for tracking patient visits to medical clinics. There is a contact information table for storing the usual information about a patient. This table has a PatientID field that is used as the PK for this table, and it is the FK for all of the other tables in the database.
I have a form (Patient Encounter Sheet) for entering the information about the clinic visit. This this form has an unbound combobox for selecting the Patient ID number and various subforms for entering the visit information. The combobox (on the main form) gets its list from the contact information table.
The subforms are all bound to tables for storing the information on the subforms. These subforms all have either option groups or various checkboxes for making selections to describe the clinic visit.
I would like to have the PatientID number (chosen in the combobox) be automatically entered in the PatientID field of the underlying tables for the subforms.
I think I can probably do this with a "Private Sub PatientID_Change()" in the class module for the Patient Encounter Form (Mainform).
I would have to check if the previous value of the combobox was Null or not, because the form (and all of the subforms) open to a new record. If the previous value was Not Null then I would have to create a new record and then enter the PatientID number in the PatientID field of the underlying forms. If the previous value of the combobox was Null then I would just have to get the value into the underlying tables.
Either way, I am stumped on what VBA code to use to get the combobox value into the tables underlying the subforms. The combobox (actually the field on the contact information table that the combobox gets its list from) is a text datatype.
I have attached a screenshot of a portion of the Patient Encounter Sheet to give you some idea of what I am blathering on about.
Any help is appreciated.
John V