View Full Version : Input Box


NigelShaw
09-21-2008, 05:19 PM
Hi,

just a quickie really. i am using an input box for a password. the box works ok and the lookup for the password works ok too. i have a condition set to prompt a msgbox if the password is incorrect which too works ok.

my small problem is cancel. if i click it, i still get the wrong password msg. if i click the close icon ( top right), i still get the incorrect msg.

i cannot seem to find a cancel option for the input box.

does one exist? its not in the help file either


many thanks,

Nigel

boblarson
09-21-2008, 05:32 PM
Just use this instead:



Dim strPwd As String

strPwd = InputBox("Enter Password")

If strPwd <> "" Then
... the rest of your code here
End If

NigelShaw
09-21-2008, 05:52 PM
Hi Bob,

thanks for your reply.

i used this

Private Sub Command1_Click()

Dim sInput As String

strInput = InputBox("Please enter your password", _
"Enter Password Box", _
"Password")

If StrPtr(strInput) = 0 Then

MsgBox "Cancelled!"

Else

If Len(strInput) = 0 Then
MsgBox "You need to enter a password!"
Else
MsgBox "Welcome"

End If 'Len(strInput)

End If 'StrPtr

End Sub


regs,

Nigel