Input Box and Limit (1 Viewer)

seany

Registered User.
Local time
Today, 18:19
Joined
Sep 1, 2003
Messages
53
I am trying to uses a inputbox. I need it to end the script if cancel is hit, but the value from the input box can be zero? So cant filter it that way.

Also

Does the SQL command LIMIT work in access and is it possible to number row in order?
 
Last edited:

Bat17

Registered User.
Local time
Today, 18:19
Joined
Sep 24, 2004
Messages
1,687
If you cancel an input box it returns and empty string and you can test for that

HTH

Peter
 

seany

Registered User.
Local time
Today, 18:19
Joined
Sep 1, 2003
Messages
53
The Input box can be null so can't filter it that way?
 

ghudson

Registered User.
Local time
Today, 13:19
Joined
Jun 8, 2002
Messages
6,194
Depends if you know how to code it. :p

Input boxes are a bad choice to use but if you insist then this is how to do it. Nulls, emptystrings, clicking the cancel button and inputting the wrong string will all return false.

Code:
Dim strInput As String
Dim strMsg As String
    
Beep
strMsg = "This form is used only by the ''Special Form'' people." & vbCrLf & vbLf & "Please key the ''Special Form'' password to allow access."
strInput = InputBox(Prompt:=strMsg, Title:="Special Form Password")

If strInput = "SpecialFormPassword" Then 'password is correct
    DoCmd.OpenForm "YourSpecialForm"
    DoCmd.Close acForm, Me.name
Else 'password is incorrect
    MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''Special Form''.", vbCritical, "Invalid Password"
Exit Sub
 

Bat17

Registered User.
Local time
Today, 18:19
Joined
Sep 24, 2004
Messages
1,687
I don't think it can be Null, which is differnt from an empty string

just filter for the "", but if you want to make sure you could do

if NZ(YourReturnValue,"") = "" then

Peter
 

Users who are viewing this thread

Top Bottom