I've figured out to use DLookup and Comboboxes in forms, thanks to the excellent help in this lesson and the other DLookup videos. I now want to create a few reports, but the fields in Comboboxes I've used in the forms only leave numbers in the underlying tables I'm using in reports. How do I get the report to convert those ID numbers back to actual data (like person's names) in the reports? Can I use DLookup? Or should I use some other trick? --Kent J.
Yep. DLookup and a text box. OR you could join the other table into a query and get the value that way. I recommend that if you have lots of records in your report. DLookup is slow. One record? Fine. 10,000 records, it'll slow things down a lot.
I didn't realize this was posted in the Access Expert 10 class... this is the class where I literally show you how to do just that in the invoice. :)
Kent JamisonOP
@Reply 3 years ago
Richard,
Found it, at the very, very end (last 2 mins) of Lesson 3. I missed it when going through it before asking the question. Sorry for the bother.
Ok. Call me stupid. I'm still not getting this. Here's a screenshot of my SupervisorT, with the primary key and foreign keys to my CurrentPersonnelID, respectively. In it have saved the values from the SupervisorCombo and TeamLeadCombo from my SupervisorF form. I want to now create a report that shows all the names of each employee's name and their team lead and supervisor. I've reviewed the OrderInvoiceQ in your Invoicing TechHelp video, which is a very good review, and Expert 10, Lesson 3. I've tried dozens of permutations of DLookUp to change the values from SupervisorCombo and TeamLeadCombo in SupervisorT. Nothing seems to show the names of the people as found in my CurrentPersonnelT. I'm thinking it should be something like: =DLookUp("LastName","CurrentPersonnelT","CurrentPersonnelID=" & [SupervisorID]), but this gives an #Error in each space.
Kent JamisonOP
@Reply 3 years ago
Adam Schwanz
@Reply 3 years ago
SupervisorID is your autonumber it looks like? Wouldn't you want to do CurrentPersonnelID?
Kent JamisonOP
@Reply 3 years ago
Adam, I've tried that before too, and it gives me a circular reference error. Because the team leads, supervisors, and employees are all in CurrentPersonnelT.
If CurrentPersonnelID, Supervisor(ID?), and TeamLead(ID?) all point to the CurrentPersonnelT then you'll bring in THREE separate copies of that table into the query and make separate joins to each field. Watch the Self Join Relationships video. You'd do the same thing with Mother and Father... join to the same table twice.
Kent JamisonOP
@Reply 3 years ago
Kent JamisonOP
@Reply 3 years ago
It took some finagling, but I finally figured it out. The key turning point was taking the three separate copies of CurrentPersonnelT and labeling the fields with no suffix, suffix "_1", and suffix "_2", accordingly in SupervisorQ. This way Access can distinguish which copy of the CurrentPersonnelT to pull the appropriate field from. Thanks for the pointers; it put me on the right path to figuring ou the solution.
Here's some unsolicited constructive feedback: Add the suffix to your Self Join Relationships or Invoicing videos because I couldn't find any mention of it in any of them.
When you bring a table into a query multiple times access automatically adds that suffix. You just have to know to bring the field in from the correct table. Maybe I'll do an updated video on this.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 10.