Dec 1 2009, 08:46 PM
I hope someone can take a look at my Dlookup statement and identify my error. I'm using the statement as the source for an unbound control on a Tab page.
=Nz(DLookUp("[Address]","Bidders","BidderID = " & cboBidder.Column(0)))
Address is a field in the table "Bidders". BidderID is a LongInt FK to the Bidders table. The combo box, cboBidder, is located on the same Tab page as the unbound control with this statement. I added the NZ because the value for BidderID will be null for many records. I've tried some variations on this statement, but this looks like one that should produce a good result. But no..
Thanks so much,
Dec 1 2009, 09:57 PM
I don't see a problem on the surface, although I think you do not need the column reference in the criteria.
Try it this way instead.
=DLookUp("[Address]","Bidders","BidderID = " & NZ(cboBidder, 0))
Dec 2 2009, 06:23 AM
I didn't see a problem with the statement either, but I like your arrangement better. Unfortunately it still didn't produce the result. I knew if your version didn't work, there had to be something I was overlooking. So I walked away, put it out of my mind and it suddenly hit me that I had the table wrong. It should be:
=DLookUp("[Address]"," tblBidders ","BidderID = " & NZ([cboBidder],0))
Worked like a charm. I've really been struggling for awhile to master Access and I've made some great progress, but it's still easy to make stupid mistakes.
Thanks for your guidance, George. I'm an avid reader of UA and I've been a big fan of your posts!
Dec 2 2009, 10:03 AM
Been there, Done That. We all have. It's part of the joy and frustration of working with my favorite application.
Continued success with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here