Create a text box that looks up a value in a table

V

vanmen

I've been trying to get dlookup to work without success.

I'm trying to get a title of a class to be inserted depending on the number
of the class.

I tried =DLookup("[Title]","[ Course Listing]",â€[Course #])

and I get "invalid syntax" message. Can anyone help? Thanks.
 
S

Steve

Assuming the text box is named EnterCourseNum and the field in the table is
named CourseNum, you need:

=DLookup("[Title]","[ Course Listing]","[CourseNum] = " & Me!EnterCourseNum)

Steve
(e-mail address removed)
 
T

Tom van Stiphout

On Sat, 22 May 2010 16:42:01 -0700, vanmen

DLookup takes two or three strings. Your last one is not terminated.
It should be ”[Course #]"
Once you do that, it will still not work. That's because the third
string is supposed to be a where-clause, typically:
fieldname = value
For example:
"[Course #] = " & Me.myCourseNoControl

-Tom.
Microsoft Access MVP
 
S

Steve

That's just what I said four and a half hours ago!

Steve


Tom van Stiphout said:
On Sat, 22 May 2010 16:42:01 -0700, vanmen

DLookup takes two or three strings. Your last one is not terminated.
It should be "[Course #]"
Once you do that, it will still not work. That's because the third
string is supposed to be a where-clause, typically:
fieldname = value
For example:
"[Course #] = " & Me.myCourseNoControl

-Tom.
Microsoft Access MVP

I've been trying to get dlookup to work without success.

I'm trying to get a title of a class to be inserted depending on the
number
of the class.

I tried =DLookup("[Title]","[ Course Listing]","[Course #])

and I get "invalid syntax" message. Can anyone help? Thanks.
 
J

John... Visio MVP

You are showing your lack of awareness to the details. You did not submit a
post at 5:30am as you indicate, your post was at 7:52 last night.

Of course, details and facts are not your strong point.

John..
Steve said:
That's just what I said four and a half hours ago!

Steve


Tom van Stiphout said:
On Sat, 22 May 2010 16:42:01 -0700, vanmen

DLookup takes two or three strings. Your last one is not terminated.
It should be "[Course #]"
Once you do that, it will still not work. That's because the third
string is supposed to be a where-clause, typically:
fieldname = value
For example:
"[Course #] = " & Me.myCourseNoControl

-Tom.
Microsoft Access MVP

I've been trying to get dlookup to work without success.

I'm trying to get a title of a class to be inserted depending on the
number
of the class.

I tried =DLookup("[Title]","[ Course Listing]","[Course #])

and I get "invalid syntax" message. Can anyone help? Thanks.
 
J

john

hi! nice to meet you.
Steve said:
That's just what I said four and a half hours ago!

Steve


Tom van Stiphout said:
On Sat, 22 May 2010 16:42:01 -0700, vanmen

DLookup takes two or three strings. Your last one is not terminated.
It should be "[Course #]"
Once you do that, it will still not work. That's because the third
string is supposed to be a where-clause, typically:
fieldname = value
For example:
"[Course #] = " & Me.myCourseNoControl

-Tom.
Microsoft Access MVP

I've been trying to get dlookup to work without success.

I'm trying to get a title of a class to be inserted depending on the
number
of the class.

I tried =DLookup("[Title]","[ Course Listing]","[Course #])

and I get "invalid syntax" message. Can anyone help? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top