Hello All,
I have a form called frmSchedule. Within this form, I have a combo box called cmbCD. I have code in the cmbCD NotInList Event. If the user inputs a number not in the list, the folowing code opens up a new form (frmPatients). The user can now add a new record to the database.
I got this code from a member of this forum, and it works woderfully. So thank you all for that.
However, when the user inputs a new number in frmSchedule, the NotInList event takes them to frmPatients. The users then have to re-type the number in frmPatients.
My question is: Is there a way I can trasfer the NewData from frmSchedule into frmPatients, so the users don't have to re-type the number?
Thank you for taking the time to read this post.
I have a form called frmSchedule. Within this form, I have a combo box called cmbCD. I have code in the cmbCD NotInList Event. If the user inputs a number not in the list, the folowing code opens up a new form (frmPatients). The user can now add a new record to the database.
Code:
Private Sub cmbCD_NotInList(NewData As String, Response As Integer)
Dim Result
Dim Msg As String
Dim CR As String
CR = Chr$(13)
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Ask the user if he or she wishes to add the new participant.
Msg = "The CD Number '" & NewData & "' is not in the Database." & CR & CR
Msg = Msg & "Do you want to add this person to the Database?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then
' If the user chose Yes, start the Participants entry form in data entry
' mode as a dialog form, passing the new name in
' NewData to the OpenForm method's OpenArgs argument. The
' OpenArgs argument is used in Participants form's Form_Load event
' procedure.
DoCmd.OpenForm "frmPatients", , , , acAdd, acDialog, NewData
End If
Response = acDataErrAdded
End Sub
I got this code from a member of this forum, and it works woderfully. So thank you all for that.
However, when the user inputs a new number in frmSchedule, the NotInList event takes them to frmPatients. The users then have to re-type the number in frmPatients.
My question is: Is there a way I can trasfer the NewData from frmSchedule into frmPatients, so the users don't have to re-type the number?
Thank you for taking the time to read this post.