473,604 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DLookup questions

JLM
What am I missing here?

I have a form where I enter a "Class Code". This value corresponds to what
sits in table "class code descriptions" along with the "title" of each
"class code." Key field is "class code."

I want a text box to be populated with the "title" which corresponds to the
"class code" which I enter in the form. The control source for the text box
is:

=DLookUp("[Title]","[class code descriptions]","[CCode] = forms![CCode]")
[this is literally what I have in the control source for the field.]

I get no value returned when I know that there is are corresponding values
in the table.

What am I missing here?

thanks in advance,
jlm
Nov 12 '05 #1
6 2329
On Wed, 18 Feb 2004 11:03:42 -0700, JLM wrote:
What am I missing here?

I have a form where I enter a "Class Code". This value corresponds to what
sits in table "class code descriptions" along with the "title" of each
"class code." Key field is "class code."

I want a text box to be populated with the "title" which corresponds to the
"class code" which I enter in the form. The control source for the text box
is:

=DLookUp("[Title]","[class code descriptions]","[CCode] = forms![CCode]")
[this is literally what I have in the control source for the field.]

I get no value returned when I know that there is are corresponding values
in the table.

What am I missing here?

thanks in advance,
jlm


Re: > Key field is "class code."
Is the Key Field "Class Code" or is it "CCode"?
If the field is actually named "CCode" and it is a Number Datatype,
then:

=DLookUp("[Title]","[class code descriptions]","[CCode] = " &
Me![CCode])

where [CCode] is the name of the control on the form that shows the
number to look up.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #2
JLM

"fredg" <fg******@att.n et> wrote in message
news:tj******** *************** *****@40tude.ne t...
On Wed, 18 Feb 2004 11:03:42 -0700, JLM wrote:
What am I missing here?

I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each
"class code." Key field is "class code."

I want a text box to be populated with the "title" which corresponds to the "class code" which I enter in the form. The control source for the text box is:

=DLookUp("[Title]","[class code descriptions]","[CCode] = forms![CCode]") [this is literally what I have in the control source for the field.]

I get no value returned when I know that there is are corresponding values in the table.

What am I missing here?

thanks in advance,
jlm


Re: > Key field is "class code."
Is the Key Field "Class Code" or is it "CCode"?
If the field is actually named "CCode" and it is a Number Datatype,
then:

=DLookUp("[Title]","[class code descriptions]","[CCode] = " &
Me![CCode])

where [CCode] is the name of the control on the form that shows the
number to look up.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Key field is actually CCode and is text.
Nov 12 '05 #3
On Wed, 18 Feb 2004 11:57:27 -0700, JLM wrote:
"fredg" <fg******@att.n et> wrote in message
news:tj******** *************** *****@40tude.ne t...
On Wed, 18 Feb 2004 11:03:42 -0700, JLM wrote:
What am I missing here?

I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each
"class code." Key field is "class code."

I want a text box to be populated with the "title" which corresponds to the "class code" which I enter in the form. The control source for the text box is:

=DLookUp("[Title]","[class code descriptions]","[CCode] = forms![CCode]") [this is literally what I have in the control source for the field.]

I get no value returned when I know that there is are corresponding values in the table.

What am I missing here?

thanks in advance,
jlm


Re: > Key field is "class code."
Is the Key Field "Class Code" or is it "CCode"?
If the field is actually named "CCode" and it is a Number Datatype,
then:

=DLookUp("[Title]","[class code descriptions]","[CCode] = " &
Me![CCode])

where [CCode] is the name of the control on the form that shows the
number to look up.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Key field is actually CCode and is text.

Then use:
=DLookUp("[Title]","[class code descriptions]","[CCode] = '" &
Me![CCode]) & "'")

With spaces addedd for clarity, the Where clause is:
"[CCode] = ' " & Me![CCode]) & " ' ")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #4
JLM

"fredg" <fg******@att.n et> wrote in message
news:mw******** *************** ****@40tude.net ...
On Wed, 18 Feb 2004 11:57:27 -0700, JLM wrote:
"fredg" <fg******@att.n et> wrote in message
news:tj******** *************** *****@40tude.ne t...
On Wed, 18 Feb 2004 11:03:42 -0700, JLM wrote:

What am I missing here?

I have a form where I enter a "Class Code". This value corresponds to

what
sits in table "class code descriptions" along with the "title" of each
"class code." Key field is "class code."

I want a text box to be populated with the "title" which corresponds
to the
"class code" which I enter in the form. The control source for the
text box
is:

=DLookUp("[Title]","[class code descriptions]","[CCode] =

forms![CCode]")
[this is literally what I have in the control source for the field.]

I get no value returned when I know that there is are corresponding

values
in the table.

What am I missing here?

thanks in advance,
jlm

Re: > Key field is "class code."
Is the Key Field "Class Code" or is it "CCode"?
If the field is actually named "CCode" and it is a Number Datatype,
then:

=DLookUp("[Title]","[class code descriptions]","[CCode] = " &
Me![CCode])

where [CCode] is the name of the control on the form that shows the
number to look up.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Key field is actually CCode and is text.

Then use:
=DLookUp("[Title]","[class code descriptions]","[CCode] = '" &
Me![CCode]) & "'")

With spaces addedd for clarity, the Where clause is:
"[CCode] = ' " & Me![CCode]) & " ' ")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


There must be something really wacked out because it won't work no matter
what I enter. This can't be that difficult. BTW, can you explain the "&"
symbols and the role they play?
thx
Nov 12 '05 #5
On Wed, 18 Feb 2004 15:15:44 -0700, JLM wrote:

** snipped **
Key field is actually CCode and is text.

Then use:
=DLookUp("[Title]","[class code descriptions]","[CCode] = '" &
Me![CCode]) & "'")

With spaces addedd for clarity, the Where clause is:
"[CCode] = ' " & Me![CCode]) & " ' ")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


There must be something really wacked out because it won't work no matter
what I enter. This can't be that difficult. BTW, can you explain the "&"
symbols and the role they play?
thx


1) Let me verbalize the above lookup and see if my using words can
explain what the code does. This way, if you see an error in my logic,
you can change a Field or table name.

= Get the data in the Field named [Title] located in the Table named
[class code descriptions] where the Field in that table named [CCode]
matches the control on this form named also named [CCode].
Note: [CCode] (as per your previous post) is Text datatype.

If it still doesn't work ....
Please state what you get (or don't get).
Is there an error given?
Please copy and paste the entire DLookUp you are using.
Please also give the EXACT table and field names in the table, as well
as the name of the control on the form that contains this DLookUp.

2) The & is used to concatenate strings (put them together), so that
if you write = "This is " & "a line of " & "Text", it would read
"This is a line of text".

In the where clause portion of the DLookUp above, Access will assemble
the clause like this, (assuming the value in the [CCode] control in
the form is "ABC123"):
"[CCode] ='ABC123' "
(I've separated the single and double quotes for clarity.)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #6
JLM

"fredg" <fg******@att.n et> wrote in message
news:au******** *************** ****@40tude.net ...
On Wed, 18 Feb 2004 15:15:44 -0700, JLM wrote:

** snipped **
Key field is actually CCode and is text.
Then use:
=DLookUp("[Title]","[class code descriptions]","[CCode] = '" &
Me![CCode]) & "'")

With spaces addedd for clarity, the Where clause is:
"[CCode] = ' " & Me![CCode]) & " ' ")
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


There must be something really wacked out because it won't work no matter what I enter. This can't be that difficult. BTW, can you explain the "&" symbols and the role they play?
thx


1) Let me verbalize the above lookup and see if my using words can
explain what the code does. This way, if you see an error in my logic,
you can change a Field or table name.

= Get the data in the Field named [Title] located in the Table named
[class code descriptions] where the Field in that table named [CCode]
matches the control on this form named also named [CCode].
Note: [CCode] (as per your previous post) is Text datatype.

If it still doesn't work ....
Please state what you get (or don't get).
Is there an error given?
Please copy and paste the entire DLookUp you are using.
Please also give the EXACT table and field names in the table, as well
as the name of the control on the form that contains this DLookUp.

2) The & is used to concatenate strings (put them together), so that
if you write = "This is " & "a line of " & "Text", it would read
"This is a line of text".

In the where clause portion of the DLookUp above, Access will assemble
the clause like this, (assuming the value in the [CCode] control in
the form is "ABC123"):
"[CCode] ='ABC123' "
(I've separated the single and double quotes for clarity.)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


From reading the online help sections of DLookup, I understand the logic of
the function. But for some reason, it isn't returning any data. Here are
the details of my situation.

Form: (I've modified it slightly since my last post. The changes are shown
here.) I created a Text Box called LookupTitle, on a form. In the Control
Source of this box I have, =DLookUp("[Title]","[class code
descriptions]","[CC] = ' " & Me!CC & " ' "). (Btw, I think your example had
an extra ")" in it.) With this in place, and when I look at the FormView,
the text box reads, #name?. When I enter a value in the CC field (which
will populate [TblEmp].[CC]), I expect to see LookupTitle filled with data.
(I didn't realize that "&" can be used in this instance. I use it all the
time in queries (which I guess is what I'm trying to do with DLookup).)

The form data source is a query that includes, among other things, the Class
Code and Title of each employee listed in that table. Fields CC and Title
on both tables have identical properties.

Table name: class code descriptions
fields: CC - text 6, Title - text 30.
record example: B2F2XX Budget Analyst II

Thanks for your patience in this. Let me know if I've omitted anything in
my description.
jlm
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2946
by: Sue | last post by:
I sent an e-mail below and got a responese but i still have the #error message in the subject below: Can someone help me: questions and replies are separted by ----- -------My Questions: I have a form with a field that automatically popluates with todays date called "created date". I have another field on the form called "Processing Month1" that I want to update automatically base on a schedule in a
11
2213
by: MLH | last post by:
DLookup("", "tblPreliminaryVINs", "=Forms!frmVINODO!SerialNum") is giving me a Type Mismatch error. That's confusing to me and I don't know how to circumvent it. The field in tblPreliminaryVINs is a 17-char text field. Forms!frmVINODO!SerialNum is just an unbound textbox on a form (frmVINODO). I run the DLookup during the textbox's BeforeUpdate event code. Some VIN values I type in there do NOT give rise to the error. Some do. By
4
3778
by: Karen Bielska | last post by:
I have a table "Customer" with two fields "CusID" (autonumber, PK) and "CusName" (text). If I know the customer's ID, say 215, how can I find the name using DLookup? PS: I'm not really looking for an answer, I merely wish to be the one millionth person to ask this question in the Access newsgroups before even glancing in the help file. Thanks in advance
2
2271
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 used DLookup several times and I've actually re-created the same lookup just in different forms. Here's my problem. I'm using dlookup when I enter a part description it adds the part number for me. I choose the part description from a combo...
12
10631
by: AricC | last post by:
Howdy Errrrbody, I'm new here! I have a few questions that I can't seem to get answered, maybe you all can help. I am writing an access program ( first time I'm accustomed to .Net + Sql Server ) I am trying to select the Max ID from a table and store so I can use that ID in a referenced table here is what I have tried: intReturnGoodsAuthorizationID = DMax("", "") This should return 10 (the highest ID) but it returns 0
2
1417
by: alphaomega3 | last post by:
I need to know is it possible to do a DLookup to two different Tables provided a checkbox is checked. The example will be if checkbox1 is checked then Dlookup Data in table1 or if Checkbox2 is checked then Dlookup data in table2.
5
4803
by: hrreece | last post by:
I have a form, Master List Temp, in Access 2003 that uses the Dlookup command to pull values from another table, Address Master. The user types in a person's home phone number in the HomePhone field on the form and the command looks up information in the Address Master table pertaining to the First Name, Last Name, etc. that match the HomePhone number criteria This allows the user to see if information for the account already exists. The...
9
6627
by: | last post by:
In my database I have a 'control table' in which basic info is stored about the application, for instance the application's path and the name of the company that is using it. In all of the application's reports I have a page footer with an unbound field that retrieves and shows the name of the company. This is done by Dlookup. My question is: is Dlookup the best way to do this, performance wise, or is there a more efficient way? Thanks in...
15
3104
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 assign an Age Correction value to hearing test results - since some degree of hearing loss naturally occurs with aging - OSHA lets us calculate that in before determining if the employee has an actual "significant" hearing loss. Anyway...I have my...
0
7997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7929
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5882
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.