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

    DLookup only returning first value from table

    Hi



    I wonder if someone could help.

    I am using a DLookup function on a command button to populate a field on a form with value from another table. However it only seems to populate the field with the top value from the table.

    Below is the code

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

    Any help will be much appreciated.

    Thanks

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by Mohamed View Post
    Hi

    I wonder if someone could help.

    I am using a DLookup function on a command button to populate a field on a form with value from another table. However it only seems to populate the field with the top value from the table.

    Below is the code

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

    Any help will be much appreciated.

    Thanks
    DLookUp only returns on record at a time. If you don't place criteria in the funtion it will return the fist record in the table. In order to get the record you are looking for, you must put in combination of criterias.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-20-2011, 03:23 PM
  2. Replies: 1
    Last Post: 08-13-2011, 12:03 AM
  3. Replies: 6
    Last Post: 06-15-2011, 11:48 AM
  4. Replies: 10
    Last Post: 05-19-2010, 10:34 AM
  5. Replies: 2
    Last Post: 02-14-2010, 01:38 PM

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