By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

DLookUp not working

P: 68
Hi ADezii,
I just want to thank you for your brilliant answer to my question on populating my reports to a combo box on my form. It works very well.

I also have a problem with my dlookup. I have developed an entry form with a combo box it containing a list of school codes. I would like to populate other details from the school table to the fields on the form for data entry purpose. This is what I have so far but is not working:
Expand|Select|Wrap|Line Numbers
  1. Me.SName = DLookup("[SchoolName]", "tblSchools", "[cboSchoolCode]='" & Me.[cboSchoolCode] & "'")
Expand|Select|Wrap|Line Numbers
  1. Me.txtCounty = DLookup("[County]", "tblSchools", "[cboSchoolCode]='" & Me.[cboSchoolCode] & "'")
But this is not just working.
Thanks for your assistance.
Oscar
Jun 27 '12 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,492
You refer to your field in the Criteria parameter of your DLookup() call as [cboSchoolCode]. It would be very unusual for a field to have such a name. This looks like the name of the control on the form, but you need to filter by the field.

I must guess, but something like :
Expand|Select|Wrap|Line Numbers
  1. Me.SName = DLookup("[SchoolName]", "[tblSchools]", "[SchoolCode]='" & Me.cboSchoolCode & "'")
Jun 27 '12 #2

P: 68
@NeoPa
Hi NeoPa,
You were right. Thanks for this.
Cheers!
Jun 27 '12 #3

P: 68
@NeoPa
Thanks again, NeoPa. I want to use DLookUp in a report as I did with the form so that, when I select a School Code from the dropdown list, the information will populate to the report I want to generate.
I will appreciate your assistance that.
Thanks.
Jun 27 '12 #4

NeoPa
Expert Mod 15k+
P: 31,492
That would require another thread Oscar, but have you not already posted such a question and got help from ADezii?
Jun 27 '12 #5

P: 68
@NeoPa
Sure NeoPa, I can do just that. ADezii helpped with populating my list of report to a combo box on my form, and it worked perfectly. But I will thread in this one with the codes I have so far, but it seems just long and not giving me the results.
Thanks
Jun 28 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.