Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2014

    Question Unanswered: Use Dlookup in Forms

    I am using Access 2013. I have built several forms titled Shippers, Recievers, Drivers, and Products. I am building another form named Dispatch. This form needs to draw information from each of these other forms to build the dispatch sheet for the drivers. I have built Lookups on the Dispatch for each of their "ID" codes. Now I want to pull their pertinent information onto the Dispatch form but I cannot get it to run. I have been trying to enter it into the CONTROL SOURCE as follows but it will not run.

    =DLookUp("ReCity","Recievers","ReWayneID=" & [Form]![Recievers]![ReWayneID])

    What am I doing wrong? This should be very simple, but I seem to be missing something.
    Last edited by JoeB1; 01-20-14 at 09:26.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    so have you checked you are getting sane value?
    ..set a breakpoint on the code and make certain that [Form]![Recievers]![ReWayneID] is what you think it is
    ..check the datatype, if ReWayneID is numeirc then your code shoudl work, if its text/string then you need to delimit it with a quote mark
    =DLookUp("ReCity","Recievers","ReWayneID='" & [Form]![Recievers]![ReWayneID] & "'")
    Im not a fan of pulling stuff liek this from other forms, as its easy code to break
    if the other form isn't loaded
    dlookup will return null if it can't find a matching result.. is that what you want
    Dlookup is fine for occasional use, but haivng 3 spearate but logically interlinked forms doenst' feel right. I think I'd probably want to have combo boxes that pull the data as required. remember to provide a requery/refresh button that refreshes the combo boxes to make certaint hey have the most upto date information
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2014
    Thanks for your response. ReWayneID is Text. I plugged that in and get back #NAME?

    If I put just =DLookUp("ReCity","Recievers") returns the first City in the Table.

  4. #4
    Join Date
    Jan 2014
    I'm just reading more here. The form I am trying to build is basically an ODERS form. I do need to pull all that info in on a daily basis, actually as many as 150 orders in a day. Is there a better way to do this? I haven't done programing for many years, last I did was in DOS on DBASE.

Posting Permissions

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