Full Version: DLookup statement producing #Error
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
RickP99
Hey,

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,
Rick
GroverParkGeorge
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))
RickP99
Hi George,

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!

Rick
GroverParkGeorge
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.

George
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.