Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input function Error 1

Status
Not open for further replies.

jailerg013

Technical User
Nov 19, 2003
16
US
Could anyone help me? I wrote the following vb to require a passcode to validate a yes/no check box.
Code:
Private Sub Check41_BeforeUpdate(Cancel As Integer)
Dim strInput As String, strMsg As String
   
  strMsg = "Enter Authorization Code"
    strInput = InputBox(Prompt:=strMsg, Title:="Code Verification", XPos:=2000, YPos:=2000)
        If strInput = 625 Then
         Forms![Master list add]!Check41 = 1
        Else
         MsgBox "Incorrect Code"
         Forms![Master list add]!Check41 = 0
        End If
End Sub
it works the way I need until you click the cancel button on the msgbox.What can I do to remove the cancel button or not have the error.
 
Check the value of strInput and make sure that it is not an zero length string.

strInput = InputBox(Prompt:=strMsg, Title:="Code Verification", XPos:=2000, YPos:=2000)
If (Len(strInput) > 0) Then
If strInput = 625 Then
...
Else
MsgBox "Cancel Button Pressed"
<do what you need to do in this case>
Endif

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thank you for helping me! I Really appreciate it.

Would you also know of anyway I can make the input box display *astericks as you type, similar to a password input mask.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top