Results 1 to 4 of 4

Thread: Error 3078

  1. #1
    Join Date
    Feb 2014
    Location
    Pittsburgh, USA
    Posts
    28

    Unanswered: Error 3078

    Hi Everyone,

    This Problem has been a big pain.. It seems simple enough but I cannot get over this error.

    I need to access 2 forms only if the Password entered in an Inputbox is correct. So I have created a table called PasswordT where I have the Passwords saved, each with a pass ID (text ID). Once the user clicks on a command button, a message box asks for the Password. The user then enters it and the code looks for the Password with the same pass ID, using Dlookup, and checks if the inputted Password is the same. If yes, it opens a new form.

    My Password table is called PasswordT. The ID is called PasswordID and the actual Password is called Passw. The code in vba is:
    strPasswd = DLookup("[PasswordT]", "Passw", "PasswordID = 'Herford' ")

    But I Keep on getting the 3078 error. Any clue what I am doing wrong?

    Much appreciated!!!

    Thanks,

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    The syntax of the DLookup function is:
    Code:
    Result = DLookup("ColumnName", "TableName", "Criteria")
    According to your explanations, you should then use:
    Code:
    strPasswd = DLookup("Passw", "PasswordT", "PasswordID = 'Herford' ")
    Be also aware that DLookup() will return Null if no match is found. This will create another error if, as I believe, strPasswd is declared as string.
    To prevent that, use:
    Code:
    strPasswd = Nz(DLookup("Passw", "PasswordT", "PasswordID = 'Herford' "), "")
    and test the length of strPasswd after calling DLookup(). If it's zero then no match was found.
    Have a nice day!

  3. #3
    Join Date
    Feb 2014
    Location
    Pittsburgh, USA
    Posts
    28
    Sinddho, you have saved my life yet again.

    Thanks a Million!

    PS: Stupid mistake.. should have figured it out on my own

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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