473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

DLookUp not working

68 64KB
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
5 2104
NeoPa
32,556 Expert Mod 16PB
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
Stoic
68 64KB
@NeoPa
Hi NeoPa,
You were right. Thanks for this.
Cheers!
Jun 27 '12 #3
Stoic
68 64KB
@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
32,556 Expert Mod 16PB
That would require another thread Oscar, but have you not already posted such a question and got help from ADezii?
Jun 27 '12 #5
Stoic
68 64KB
@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

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

Similar topics

2
by: Ronny Sigo | last post by:
Hello all, I already put the same question, only now I have more to tell ... Although I used this code before in the same routine (only the fieldname of the table differs) ___ at this point in the...
4
by: Joe | last post by:
I have a table with an sequence (PK) and 2 fields, employee id and status id. Each employee can have multiple records in this table due to multiple status ids assigned. I have a multi-list box...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
2
by: Don | last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with Access. I've been creating databases for several years for work with the help of many of you and trial and error. I have...
3
MSeda
by: MSeda | last post by:
I have a loop that is controlled by a Dlookup statement with two criteria. Both criteria fields are checkboxes. I have tried an assortment of quotation marks in the criteria section and cannot get...
2
by: jonvan20 | last post by:
I have been having trouble with a simple Dlookup command that was Reccommended to me by a nice fellow named Vic, On the other hand I have statements like this that wont run they give me a run time...
0
by: musman | last post by:
hey all, I have tried to use the select statement instead DLookUp function as i have sql server at my backend and access as my front end. But neither DLookUp function is working nor select state...
2
by: squiggly12 | last post by:
Hello all, I have this interesting problem and it has me scratching my head. I have updated a few forms to use CDOSYS to email instead of using the doCmd.SendObject. Dim objMessage As...
15
by: rleepac | last post by:
This is a little complicated but I'll do my best to explain. In my db I have a table called L_AgeCorrection which has the following fields: Age, Sex, Frequency, AgeValue This is a table used to...
11
by: rahuld | last post by:
=Sum(Dlookup(.... does not work for me as the dlookup has 4 criteria and table has some 15000 lines, the sum(dlookup...) causes access to shut down, the dlookup however is working just fine. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.