Results 1 to 8 of 8
  1. #1
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117

    Help with multiple criteria DLookup

    Hello,



    I know there are several Dlookup threads already, but I have still been unable to develop a solution.

    I have a DB that tracks tooling. Every time a tool is checked out to a user a record is created in table "tlogIssued", this record stores (among other things) the tool's ID, the date the tool is being checked out, and it also adds a status note indicating if the tool is "checked out" or "checked in".

    I am adding a functionality to scrap tools, and I need to log every occurrence. On the new scrap log one of the things that is desired to be recorded is when the tool was last checked out.

    Enter my dlookup problem- I need my dlookup to draw the 'lastissueddate' from the tlogIssued table, the only way I have come up to do this is by using multiple criteria and having the dlookup search by "toolID" (which works fine on its own) and then somehow (and this is where I am lost) by the last occurrence of the words "checked out" in the status note field (called field "InOut") for that particular toolID.

    My code currently looks as follows:
    Code:
    DLookup("issuedOn", "tlogIssued", "[toolId]=" & Me.bxToolID.Value & " And [InOut]= " & Checked Out")
    I know the above code has incorrect syntax, and I also realize that it won't find the last occurrence of the "Checked Out" status identifier.

    Any and all help is appreciated.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Do you need to know to whom the Tool was assigned/given to?
    Your process seems very similar to the Loan of a Library Book.

    Customer borrows Book(with Title = "TITLE") on DateX to be returned on or before DateY.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Try NOT to use Dlookup. Slooowwww.
    use a query with parameter from the form: forms!frmMain!bxToolID

    i myself open a continuous form on the person. It shows all items of that person, date descending. Then I can scroll thru.

  4. #4
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by orange View Post
    Do you need to know to whom the Tool was assigned/given to?
    Your process seems very similar to the Loan of a Library Book.

    Customer borrows Book(with Title = "TITLE") on DateX to be returned on or before DateY.
    Orange- The idea is the same. As far as logging the check out/check in process that is established and functions well. The data is stored in the aforementioned table tlogIssued.

    The process I'm trying to implement now, would be analogous to removing a book from the library collection permanently. However, in this case I need to be able to record the last time the tool was checked out.

    99% of what I am using to log the check out/ check in process works to log the scrapping of the tool. However, the dlookup I'm trying to get to work is needed (unless there is a better way) to go in and find the last instance the tool was checked out and then insert that date into a field. I know how to insert the data once found, I just can't figure out how to look up the last checked out date. As far as knowing who last checked out the tool, yes I need to know that as well, but I figured if I can get the dlookup figured out to find the last checked out date, then it is just a matter of redirecting the dlookup to a different field in table tlogIssued in order to find who the tool was last checked out to. Hopefully that is more clear.

    Quote Originally Posted by ranman256 View Post
    Try NOT to use Dlookup. Slooowwww.
    use a query with parameter from the form: forms!frmMain!bxToolID

    i myself open a continuous form on the person. It shows all items of that person, date descending. Then I can scroll thru.
    Ranman- So hopefully the above description provides some clarification. I'm not against a continuous form to display the data. Unfortunately we are not set up to where each user has a running history. The idea in lieu of that, is that there is a running log of tools which are scrapped. This log (table) can then be queried and reports made for varying specifics. The methodology of input into this scraplog/table is that when a tool's detailed information page is edited and tool location is changed to show "scrap" then a before update event is triggered which collects all the required data and writes it to the scraplog/table. The only piece of information I am unable to collect is the last checked out date. (As mentioned above, I do also need to know who it was checked out to, but if I can get one I can get the other.)

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  6. #6
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by orange View Post
    Please post a jpg of your relationships window.
    Here it is.

    Click image for larger version. 

Name:	AccessRelationshipWindow.jpg 
Views:	19 
Size:	173.4 KB 
ID:	20426

  7. #7
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Well I figured out a solution- rather than try to have everything done programmatically, I created a form which allows the data to entered into the scrap log/table. Then using queries I was able to make the last issued to/on information select-able in combo boxes on my form.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

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

Similar Threads

  1. DLookup with multiple criteria
    By RunTime91 in forum Access
    Replies: 4
    Last Post: 02-08-2015, 08:28 PM
  2. Dlookup multiple text criteria from vba variables
    By trevor40 in forum Programming
    Replies: 4
    Last Post: 02-03-2015, 04:20 PM
  3. Using DLookup with multiple criteria
    By halt4814 in forum Access
    Replies: 2
    Last Post: 04-08-2013, 12:26 PM
  4. Replies: 11
    Last Post: 04-30-2012, 07:22 PM
  5. Multiple criteria in DLookup
    By crowegreg in forum Forms
    Replies: 7
    Last Post: 06-22-2011, 01:47 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