Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invalid use of null (Access 2000)

    I am using a password based on the number of the field FaxNumber in the table.It works fine in case there is some number of the FaxNumber.On opening the form I get the dialog box “ Please enter the password.” I can open the form by pressing the OK without entering the password, and then some controls are not visible. That’s what I want.If I enter the paswrod, some controls are visible.
    Everything works OK in case there are some figures in the field FaxNumber.However, if the field is blank, i.e. no figure exists, on pressing the OK I get the error Invalid use of null. How can I avoid this error ? Below is my code :

    stDocName = "frmWarehouse"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Dim strPassword As String
    Dim strPIN As String
    strPassword = InputBox("Please enter the password")
    strPIN = DLookup("FaxNumber", "[my company information]")
    If strPassword = strPIN Then.....

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Invalid use of null (Access 2000)

    A string variable cannot be Null, so strPIN should not be a string. Change its declaration from

    Dim strPIN As String

    to

    Dim strPIN As Variant

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid use of null (Access 2000)

    I changed it and now it is OK ! Thank you !

Posting Permissions

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