Results 1 to 3 of 3
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Dlookup syntax

    I can't figure out what my syntax should be.
    HTML Code:
    Me.MidSalaryRange = DLookup("[Midpoint]", "FTE_Salary_Ranges", "[Schedule] = " & "'" & strLookup & "'" And "[Grade] = " & "'" & Me.JobSalaryGrade & "'")
    Both fields schedule and grade exist within table "FTE_Salary_Ranges"




    Thank you in advance!!

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    this is always tricky and the correct syntax depends on the content whether it be a number or text

    definitely your first & is not correct

    strLookUp needs to be dimensioned/defined - possibly you just didn't show that...not sure

    chop it in half and drop the AND portion in order to do things in steps

    there is actually a lot of examples out there in Bing/Google on this topic....search on the WHERE clause syntax

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks for the quick update.

    In the code not displayed, strLookup is dimensioned.

    Here's what I got to work:
    Me.MidSalaryRange = DLookup("[Midpoint]", "FTE_Salary_Ranges", "[Schedule] = '" & strLookup & "' And [Grade] = '" & Me.JobSalaryGrade & "'")

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

Similar Threads

  1. DLookup Syntax Error
    By uncletreetrunk in forum Programming
    Replies: 4
    Last Post: 07-30-2012, 02:29 PM
  2. IIf and dlookup syntax
    By AndycompanyZ in forum Forms
    Replies: 3
    Last Post: 06-28-2011, 02:47 PM
  3. DLookup() syntax????
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 03-30-2011, 09:14 AM
  4. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  5. dlookup() syntax
    By markjkubicki in forum Programming
    Replies: 4
    Last Post: 08-24-2010, 12:31 PM

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