Results 1 to 5 of 5
  1. #1
    Mohamed is offline Novice
    Windows XP Access 2000
    Join Date
    Sep 2011
    Posts
    17

    Run Time Error 2645

    Hi

    Please can anyone help.



    I get the following error when trying to excute the code below

    "Run-Time Error 2645

    Microsoft Access can't find the field '|' referred to in your expression"

    Below is the code

    Private Sub Command111_Click()
    Me.Encrpytion_Password = DLookup("[Password]", "[Tableencryptionpassword]", "[EncryptionID] = " & Nz([EncryptionID], 0))
    End Sub


    I have checked the spelling of the all the fieldnames and they are correct.

    Any help would be much apprecitaed.

    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    You have different spellings of "encryption"...
    Me.Encrpytion_Password
    I think you have an unknown field in " & Nz([EncryptionID], 0))". Is this a field picked up from your form? Should it be & Nz(Me.EncryptionID, 0))? If you're getting this from a textbox, it would be a string, not a numeric, as i see it.

    Do you use Option Explicit in your vba?
    Open table "Tableencryptionpassword" and see what values exist.

    What testing have you done on this aspect of your application?

  3. #3
    Mohamed is offline Novice
    Windows XP Access 2000
    Join Date
    Sep 2011
    Posts
    17
    Hello
    I have managed to get further now.

    I dont get any coding errors now when I press the command button. However when clicking on the button it does not seem to be populating the field with a value from the table.

    Below is the code

    Private Sub Command112_Click()
    Me.lngEncryption_Password = DLookup("Password", "[tblpasswords]", "Password = '" & Nz(EncryptionID, 0) & "'")
    End Sub

    Again, any help will be much appreciated.
    Thanks

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    it does not seem to be populating the field with a value from the table.
    What field exactly are you trying to populate? Can you describe the process involved in a little more detail?

    Add this line - for debugging purposes - right before the End Sub line

    Debug.Print "Me.lngEncryption_Password is " & Me.lngEncryption_Password

  5. #5
    Mohamed is offline Novice
    Windows XP Access 2000
    Join Date
    Sep 2011
    Posts
    17
    Thanks for your help guys

    I'm almost there. I have used your code. I am now able to populate a value into the field from tblpasswords. but when i add a new record into the database and press the command button it always chooses the top value from tblpasswords. I would like it to choose the next value from the table tblpasswords.

    Any ideas how?

    My code is below


    Private Sub Command111_Click()
    Me.lngEncrpytion_Password = DLookup("[Password]", "[tblpasswords]", "EncryptionID = Password = '" < myknowngoodpassword > "'")
    End Sub

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error in Run Time
    By dongodu in forum Queries
    Replies: 5
    Last Post: 07-24-2011, 06:54 PM
  2. Replies: 2
    Last Post: 12-23-2010, 09:11 AM
  3. Replies: 2
    Last Post: 12-02-2010, 02:35 AM
  4. Run time error
    By vaikz in forum Import/Export Data
    Replies: 1
    Last Post: 02-18-2010, 11:37 PM
  5. Run Time Error 424
    By ddog171 in forum Programming
    Replies: 3
    Last Post: 02-04-2006, 07:13 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums