Results 1 to 5 of 5
  1. #1
    trinisteve is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    3

    Help with Dlookup Function matching two criteria from table to query

    Hello. I am a beginner to access. I am writing a query where I want to match two fields in the query to two fields in table (tblJobBudgetedHours) and return a different field from the table to the query. Table1 fields are JobBudgetedHoursID, JobNumber, DirectLabourCode, BudgetedHours. The query fields are JobNumber, DirectLabourCodes, DirectLabourHours (Sum), BudgetedHours. The direct labour codes have different descriptions like templating, fabricating, installing. I want to match the JobNumber & DirectLabourCodes in the query to JobNumber & DirectLabourCode in the table and return the BudgetedHours from the table to the BudgetedHours in the query. I have attempted the Dlookup function but I can't get the criteria right. I have come up with BudgetedHours: Dlookup("BudgetedHours, "tblJobBudgetedHours", XXXXXX). Can someone please assist with the criteria?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why don't you do a query that joins tables on the two fields in common?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    trinisteve is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    3
    Thanks. I could try to restructure the tables but is it possible to write a query for the existing situation.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My suggestion is for the current structure.

    What is the SQL of the query that you want to match to table? What table is this query based on? I wonder why you can't do this 'match' in the existing query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    trinisteve is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Posts
    3
    Thanks, I will restructure the tables

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

Similar Threads

  1. dlookup columns matching
    By petertje in forum Programming
    Replies: 1
    Last Post: 01-04-2014, 04:14 PM
  2. Replies: 5
    Last Post: 11-17-2013, 04:20 PM
  3. Replies: 1
    Last Post: 03-22-2013, 03:33 AM
  4. Replies: 3
    Last Post: 08-22-2012, 03:51 PM
  5. Matching or Dlookup?
    By 201034 in forum Queries
    Replies: 3
    Last Post: 07-18-2012, 06:06 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