H
HeislerKurt
A patient can have multiple referrals. frmPatients holds the patient
information and fsubReferrals hold the referral information.
On fsubReferrals, instead of using the basic add a new record approach
(DoCmd.GoToRecord , , acNewRec) and editing the form directly, I'd
like the user to click on a "Add New Referral" button and enter the
information in a popup form (frmNewReferral). When done, he hits a
"Save" button on the popup form, the popup form closes, and the
information appears in frmReferrals (where the fields are visible but
not enabled).
(If the user needs to edit the record later, he clicks on an Edit
button which opens frmNewReferral filtered for that record.)
How should I code this? Under the "Add New Referral" button, I was
thinking something like:
DoCmd.openForm "frmNewReferral", , , , acFormAdd, acDialog
Forms!frmNewReferral.RecordSource = "SELECT DISTINCTROW
tblReferrals.* " & _
"FROM tblReferrals " & _
"WHERE ((tblReferrals.PersonID=Forms!frmPatients!PatientID]));"
And then maybe some INSERT INTO into statement when he hits the save
button? I need to make sure that the PatientID gets passed into the
new referral record otherwise it will fail. Perhaps I'm over thinking
this.
Any suggestions? Thank you.
information and fsubReferrals hold the referral information.
On fsubReferrals, instead of using the basic add a new record approach
(DoCmd.GoToRecord , , acNewRec) and editing the form directly, I'd
like the user to click on a "Add New Referral" button and enter the
information in a popup form (frmNewReferral). When done, he hits a
"Save" button on the popup form, the popup form closes, and the
information appears in frmReferrals (where the fields are visible but
not enabled).
(If the user needs to edit the record later, he clicks on an Edit
button which opens frmNewReferral filtered for that record.)
How should I code this? Under the "Add New Referral" button, I was
thinking something like:
DoCmd.openForm "frmNewReferral", , , , acFormAdd, acDialog
Forms!frmNewReferral.RecordSource = "SELECT DISTINCTROW
tblReferrals.* " & _
"FROM tblReferrals " & _
"WHERE ((tblReferrals.PersonID=Forms!frmPatients!PatientID]));"
And then maybe some INSERT INTO into statement when he hits the save
button? I need to make sure that the PatientID gets passed into the
new referral record otherwise it will fail. Perhaps I'm over thinking
this.
Any suggestions? Thank you.