Message box cancel

keith701a

Registered User.
Local time
Today, 12:13
Joined
Aug 9, 2016
Messages
38
I have a button that opens a message box with an "on click" event:

Dim strInput As String
strInput = InputBox("Enter Report Number")
DoCmd.OpenForm "Update_Form", , , "Report_Number = '" & strInput & "'


The user inputs a report number and clicks okay to open "Update_Form" filtered by said report number. If cancel is clicked "Update_Form" still opens, but blank.

I would like "Update_Form" to not open and to browse to a form named "HOME" if cancel is clicked. Is there a way to build this into the code?
 
Simplest is to test for and empty string, which is what will be returned if the user clicks on cancel. Or use the Len() function.
 

Users who are viewing this thread

Back
Top Bottom