InputBoxes

csdrex87

Registered User.
Local time
Yesterday, 22:15
Joined
Jul 1, 2009
Messages
66
Ok so call me stupid or whatever but i forgot to code in the second half of the input box in case the user hit the cancel button. My code looks like this

DoCmd.OpenForm "formUserLoginAccess", acNormal
If IsNull(Forms!formUserLoginAccess!txtUSL) = True Then intCaseN = 2
Select Case intCaseN

Case 1

intUSL = Forms!formUserLoginAccess!txtUSL

strForm = InputBox("Please Enter the Name of the form you wish to fill out i.e. EmployeeDaily, EmployeeWeekly, Forecast, OrderRegister, EmployeeInformation")

If intUSL = 1 Then
DoCmd.OpenForm strForm
End If

If intUSL = 2 Then
DoCmd.OpenForm strForm, acNormal, , , acFormEdit And Form!strForm.AllowEdits = False And Form!strForm.AllowDeletions = False
End If

If intUSL = 3 Then
DoCmd.OpenForm strForm, acNormal, , , acFormReadOnly
End If

If intUSL = 4 Then If MsgBox("You do not have sufficient access to this database!", vbOKOnly, "Restricted Access") = vbOK Then DoCmd.Quit

The problem im running into is if i put in the
If strForm = "" Then
End Sub

I get the dreaded required Block If and if i put the Block End If in then I have a select issue. Is there any way for me to do this without completely redoing the select code?
 
Why not have the code check strForm right after the inputbox? You could then do something like:

if strForm = "" then
Msgbox ("You have not selected a Form. Please try again!")
exit sub
end if
 
Last edited:
That should be what you need. What is the full code when you try that? What you've posted doesn't include the End Select.
 
I took that same basic idea and simply applied a if statement that returned them to the menuform having the same effect as a cancel. So thank you for the idea :-)
 

Users who are viewing this thread

Back
Top Bottom