Hi
I am successfully using the following code for the Not In List
Private Sub Meds_NotInList(NewData As String, Response As Integer)
'Add a new Medication by typing a name in the Meds box
Dim intNewMeds As Integer, strTitle As String, intMsgDialog As Integer
'Display message box asking if user wants to add a new Medication.
strTitle = "Medication Not In List"
intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
intNewMeds = MsgBox("Do you want to add a new Medication?", intMsgDialog, strTitle)
If intNewMeds = vbYes Then
'Remove new name from Meds so
' control can be requeried when user returns to form.
DoCmd.RunCommand acCmdUndo
'Open Add location form
DoCmd.OpenForm "frm-DRUG NAMES", acNormal, , , acAdd, acDialog, NewData
'Continue without displaying default error message
Response = acDataErrAdded
End If
End Sub
My question is the following:
This opens a new form but requires the user to enter the name of the medication twice. any Ideas on how to carry the name of the medication over to the next form so it is only typed once and is the added into the list? I need the safeguard of asking the user if s/he want to add the medication to the list.
Thanks
J
I am successfully using the following code for the Not In List
Private Sub Meds_NotInList(NewData As String, Response As Integer)
'Add a new Medication by typing a name in the Meds box
Dim intNewMeds As Integer, strTitle As String, intMsgDialog As Integer
'Display message box asking if user wants to add a new Medication.
strTitle = "Medication Not In List"
intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
intNewMeds = MsgBox("Do you want to add a new Medication?", intMsgDialog, strTitle)
If intNewMeds = vbYes Then
'Remove new name from Meds so
' control can be requeried when user returns to form.
DoCmd.RunCommand acCmdUndo
'Open Add location form
DoCmd.OpenForm "frm-DRUG NAMES", acNormal, , , acAdd, acDialog, NewData
'Continue without displaying default error message
Response = acDataErrAdded
End If
End Sub
My question is the following:
This opens a new form but requires the user to enter the name of the medication twice. any Ideas on how to carry the name of the medication over to the next form so it is only typed once and is the added into the list? I need the safeguard of asking the user if s/he want to add the medication to the list.
Thanks
J