Results 1 to 2 of 2

Thread: Can you help?

  1. #1
    Join Date
    Jan 2004
    Posts
    5

    Exclamation Unanswered: Can you help?

    I am having a problem with a password entry form.
    It should when the correct password is entered lead you to the approved order but when nothing is entered it comes up with a NULL value error message; can I make it so that when a NULL value is entered it says that it is an incorrect password?

    I know that it is possible but can someone suggest the correct coding to add to the existing:

    Private Sub Command2_Click()
    Dim pwd As String
    pwd = Form_OrderPreviewPassword.txtPassword
    If pwd = "TC" Then
    MsgBox "Correct Password"
    Dim stDocName As String
    Dim stLinkCriteria As String
    DoCmd.Close
    stDocName = "FinalPassword"
    DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
    Else
    MsgBox "Correct password needed to approve orders"
    DoCmd.Close
    Dim stDocName2 As String
    Dim stLinkCriteria2 As String
    stDocName2 = "Final"
    DoCmd.OpenReport stDocName2, acViewPreview, , stLinkCriteria2
    End If
    End Sub

    Many Thanks,
    Simon Wedge

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Can you help?

    Originally posted by wedge9s
    I am having a problem with a password entry form.
    It should when the correct password is entered lead you to the approved order but when nothing is entered it comes up with a NULL value error message; can I make it so that when a NULL value is entered it says that it is an incorrect password?

    I know that it is possible but can someone suggest the correct coding to add to the existing:

    Private Sub Command2_Click()
    Dim pwd As String
    pwd = Form_OrderPreviewPassword.txtPassword
    If pwd = "TC" Then
    MsgBox "Correct Password"
    Dim stDocName As String
    Dim stLinkCriteria As String
    DoCmd.Close
    stDocName = "FinalPassword"
    DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
    Else
    MsgBox "Correct password needed to approve orders"
    DoCmd.Close
    Dim stDocName2 As String
    Dim stLinkCriteria2 As String
    stDocName2 = "Final"
    DoCmd.OpenReport stDocName2, acViewPreview, , stLinkCriteria2
    End If
    End Sub

    Many Thanks,
    Simon Wedge
    There are numerous ways to do this .... You can use IsNull, or NZ, or what I do:

    If pwd & "" = "TC" Then

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •