Results 1 to 2 of 2
  1. #1
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82

    DLookup with two criteria

    Hi All



    I cannot for the life of me get the end of the statement to work!!!

    In the criteria field of the below DLookup I want to Look up an "EndSerialNo" from the "tblOrderHistory" where The AccNo is the same as Me.AccNo AND the Style is the same as Me.txtStyle

    I must have the syntax wrong but I am tired and grumpy and have had to look for help!!

    SSer = Nz(DLookup("EndSerialNo", "tblOrderHistory", "AccNo='" & Me.AccNo.Value "'" And "Style='" & Me.txtStyle.Value & "'")

  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,726
    Code:
    SSer = Nz(DLookup("EndSerialNo", "tblOrderHistory", "AccNo='" &  Me.AccNo.Value "'" And "Style='" & Me.txtStyle.Value & "'")
    You don't have matching brackets.

    I think this is what I'd try (untested)

    Code:
    SSer = Nz(DLookup("EndSerialNo", "tblOrderHistory", "AccNo='"  &    Me.AccNo  & "'  And  Style='" & Me.txtStyle & "'"),0)

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

Similar Threads

  1. Dlookup with criteria of textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-30-2013, 03:32 AM
  2. DLookup with textfield in criteria
    By smeghead67 in forum Programming
    Replies: 4
    Last Post: 08-07-2012, 12:18 PM
  3. Dlookup with multi Criteria
    By rkalapura in forum Forms
    Replies: 2
    Last Post: 06-15-2012, 06:18 PM
  4. dlookup with a contains criteria?
    By noretoc in forum Access
    Replies: 3
    Last Post: 05-02-2012, 10:18 AM
  5. DLOOKUP criteria using variable
    By Thumbs in forum Programming
    Replies: 14
    Last Post: 02-21-2012, 08:08 AM

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