Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2002
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    DLookup does not work for me (Access 97)

    For the last 5 day I've been trying to make Dlookup do the same thing Vlookup does in MS Excel and I haven't had much luck.
    I have created a table the has the following fields: MOS (numeric), AnnBen (numeric), MonthE (text), Rate1 (numeric), and Rate2 (numeric).
    I'm trying to create a query that will return the annual benefit an employee is will be awarded. for example, if an employee has been working for use for 6 month he/she will accrue 80 hours of vacation.
    On my query I'm composing my DLookup as follows: Look: DLookUp("AnnBen","tblAnniBen","[MOSI]"=" [tblAnniBen]![MOS] "), well this is just one of the way I tried it. either it only returns the firts record or no records at all, AnnBen is the field that contains the annual benefits I need returned, tblAnniBen is the table where the data resides, MOSI is a calculated field in the query that calculates the total month of service an employee has based on their hire date this field should match to a number in the field MOS on the table tblAnniBenn. but it doesn't work.
    So what can I do? Can someone help me please.
    I have been able to create what I need on a spreadsheet, could someone please take a look at it and let me know if this is at all possible in Access.

    Thank You!
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DLookup does not work for me (Access 97)

    You're trying too hard. Dlookup returns the value from a field (AnnBen) in a domain (tblAnniBen) where a particular field (or fields) in that domain meet(s) a specified condition (or conditions). Try this in your query:

    DLookUp("AnnBen","tblAnniBen","[MOS]=" & [MOSI])

    What this says is "lookup the value of AnnBen in tblAnniBen where the MOS field is equal to the MOSI calculated value in the current record in this query.

    Does that help?
    Charlotte

  3. #3
    Lounger
    Join Date
    Jan 2002
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: DLookup does not work for me (Access 97)

    Thank you so much Charlotte.
    You were 100% correct, your suggestion was right on the money!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •