Results 1 to 4 of 4
  1. #1
    bdaniel is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    44

    dlookup function problem

    I have an expression in a query called "TrnsplWk" that properly calculates a date.



    I want another expression using the dlookup function that looks up the value in the [wkid] field in the wktable domain where the value of the [date] field = the result of the "TransplWk" expression.

    Here is my expression that successfully calculates the date:

    TrnsplWk: [readyschedule.rdyweek]-(7*[finishtable.fingrwwks])

    Trying to use the expression as the criteria in the dlookup function:

    TrnsplWkID: DLookUp("[wkid]","wktable","[date]=[readyschedule.rdyweek]-(7*[finishtable.fingrwwks])")

    results in the error: Invalid bracketing of name '[readyschedule.rdyweek]'

    When I remove the brackets from the fields readyschedule.rdyweek and finishtable.fingrwwks fields in the expression, then i get this error message:

    "can't find the name 'readyschedule.rdyweek' you entered in the expression.

    How can I use the date in calculated in the TrnsplWk expression to look up the respective value in the wktable domain? Is the problem using a date value? Is it simple syntax?

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    DLookUp("[wkid]","wktable","[date]=#" & [readyschedule.rdyweek]-(7*[finishtable.fingrwwks]) & "#")

    You have to enclose date with "#".

  3. #3
    bdaniel is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    44
    Thanks. That worked. If you have the time, can you explain the use of the =# after the [date] field, and the use of the & in the criteria? I would like to understand the use of the syntax here for the next time.

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Dates need to be enclosed by "#" to indicate the value is a date and not a string.
    '&' is used to join the different part of the string together.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-18-2010, 09:12 AM
  2. Replies: 2
    Last Post: 11-02-2009, 10:14 PM
  3. Replies: 3
    Last Post: 10-06-2009, 02:11 PM
  4. I have Problem in processing Dlookup Function
    By Katada in forum Programming
    Replies: 2
    Last Post: 04-23-2006, 12:07 AM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 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