I have simple form (2 fields and a combobox) bound to a single table. The form needs to open with the Patient_ID taken from the current main form and the ProtPat_ID at autonumber. It works now with one hiccup, the form opens with ProtPat_ID at autonumber but with an empty Patient_ID field. If I manually enter The Patient_ID, everything saves to the table as expected.
The form opens from a command button with the following code:
Private Sub btnAddPatientToProtocol_Click()
On Error GoTo Err_btnAddPatientToProtocol_Click
Dim stDocName As String
Dim sWhere As String
Dim stLinkCriteria As String
stDocName = "form8"
sWhere = " Patient_ID = " & Me!Patient_ID
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm "form8", acNormal, , sWhere
DoCmd.GoToRecord , , acNewRec
Exit_btnAddPatientToProtocol_Click:
Exit Sub
Err_btnAddPatientToProtocol_Click:
MsgBox Err.Description
Resume Exit_btnAddPatientToProtocol_Click
End Sub
How do I open the form with the Patient_ID populated with the ID from the current main form?
Thanks
The form opens from a command button with the following code:
Private Sub btnAddPatientToProtocol_Click()
On Error GoTo Err_btnAddPatientToProtocol_Click
Dim stDocName As String
Dim sWhere As String
Dim stLinkCriteria As String
stDocName = "form8"
sWhere = " Patient_ID = " & Me!Patient_ID
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm "form8", acNormal, , sWhere
DoCmd.GoToRecord , , acNewRec
Exit_btnAddPatientToProtocol_Click:
Exit Sub
Err_btnAddPatientToProtocol_Click:
MsgBox Err.Description
Resume Exit_btnAddPatientToProtocol_Click
End Sub
How do I open the form with the Patient_ID populated with the ID from the current main form?
Thanks
Last edited: