Results 1 to 2 of 2
  1. #1
    newwales is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jun 2011
    Posts
    3

    Talking Query Dlookup different fields

    I have a Recipe with a price file C97, every couple of months we create a new price field C98, C99,C100 etc… Within the recipe form I have a field that I enter which price list I want i.e C98.



    Currently I have the following in the query
    Resource_Code TotalCost2
    158165 0.156
    105179 7.5

    Below is the folmula in TotalCost2, which looks up filed C98 within Costset Table where the Resource_Codes are the same.

    Totalcost2: DLookUp([C98],"CostSet",[Resource_Code])

    What I would like is on the Form to enter C97 or C98 or C99 & for the Query Dlookup to lookup the C97/C98/C99 field automatically.


    Hope you can help.

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209

    Query Dlookup different fields

    If I understood you correctly you can use the following expression in your Query Column for bringing in the Value from Price File:

    Code:
    TotalCost2: DLookUp([Forms]![FormName]![txtBoxName],"PriceFileName","lng_Resource_Code = " & [Resource_Code])
    When you enter C97 or C98 or C99 in the Text Box on the Form the Query will lookup that field on the Price File to return the Cost for the corresponding Resource_Code in the Query.

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

Similar Threads

  1. Dlookup in query using Global variable
    By newwales in forum Access
    Replies: 1
    Last Post: 06-03-2011, 03:47 PM
  2. append query: dlookup or dmax problem
    By jeffr27 in forum Queries
    Replies: 1
    Last Post: 05-10-2011, 09:25 AM
  3. Replies: 2
    Last Post: 03-23-2011, 11:13 AM
  4. Replies: 4
    Last Post: 03-05-2010, 09:56 PM
  5. replacing dlookup fields with variables
    By msupitar in forum Access
    Replies: 0
    Last Post: 02-18-2009, 12:26 AM

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