Hello all, I'm kinda stuck here trying to figure something out. I have this function:
Code:
Function OpenFormWithInput()
Dim Msg As String
Dim Title As String
Dim Defvalue As String
Dim Answer As String
Msg = "Enter Employee Name (Last Name and First Name: Smith,John)No space after the ,."
Title = "OPEN SAFETY CHAMPION FORM"
Defvalue = "JOHN,SMITH"
Answer = InputBox(Msg, Title, Defvalue)
If Answer <> "" Then
DoCmd.OpenForm "frm_Safety_Champion_Updater", , , "[employee_name]='" & Answer & "' "
Else
DoCmd.Close
DoCmd.OpenForm "frm_EHS_Safety_Section", acNormal
End If
End Function
sample.zipWhen I call the function, the input box pops up for the user to enter the name to pull the records that have that name on it. If they put the wrong name the function will open a new form but I don’t want them entering new information on that form so on the current event of the form I entered the code that if is a new record a msg box pops and tells them that they entered the wrong name to click yes to try again and no to exit if you click yes it calls the function again and if the name is entered wrong again, even thou the blank form gives them the msg that the name is wrong or do not exist the second time around the function will open the form regardless.
I included a sample.