Using form to both enter data and view already entered data (1 Viewer)

Kuleesha

Member
Local time
Today, 18:10
Joined
Jul 18, 2021
Messages
50
I'm in the process on developing this database and am stuck at a certain point despite trying for a whole day. I'm very new to access and this is my first database.
I have this form called frmPatient which is used to enter baseline data about patients and a form called frmVisit which is used to enter visit details of a patient at each visit. The frmVisit form also has a subform frmIxResults.
On the frmPatient I have a command button set up to start a new visit and a combobox which is used to view / edit previous visits. Both use frmVisit form. With this setting i can enter new visit data into frmVisit as long as I don't try to enter data into the subform (subform dataentry set to yes). When I try to do this I get an error "you can't assign a value to this object" and when I try to move out of the subform I get an error "you must enter a value in the 'tblVisit.PatientID' field". But when I check the particular table, is already has this visit recorded. When I exit out of the form frmVisit and go into the particular visit from the combobox, I can then enter the subform and enter data.
I have tried a lot of things including setting data entry property of frmVisit to both yes and no but face with the same error irrespective of this setting.
I have attached the DB below.
I would be thankful for any suggestions.
 

Attachments

  • PatientsNew23Help.zip
    1.1 MB · Views: 471

June7

AWF VIP
Local time
Today, 04:40
Joined
Mar 9, 2014
Messages
5,423
frmVisit and frmlxResults have same data source. This is usually problematic and why Split form object was developed.

Move controls from the Page Header section into the Detail section. You will see that the PatientID textbox is empty. The subform is actually on a new record, not the same record as the parent Visit form. The Master/Child Links synchronization is not working.

Review https://www.access-programmers.co.uk/forums/threads/emulating-the-split-form.294421/
 

Kuleesha

Member
Local time
Today, 18:10
Joined
Jul 18, 2021
Messages
50
frmVisit and frmlxResults have same data source. This is usually problematic and why Split form object was developed.

Move controls from the Page Header section into the Detail section. You will see that the PatientID textbox is empty. The subform is actually on a new record, not the same record as the parent Visit form. The Master/Child Links synchronization is not working.

Review https://www.access-programmers.co.uk/forums/threads/emulating-the-split-form.294421/
Thanks for the advice. I broke down the table into 2 tables and linked each form to the relevant table. Now it's working fine.
 

Users who are viewing this thread

Top Bottom