Populate Text Box

G

Guest

I have a form with a combo box named RDIngPKID:
SELECT tblProfiles.txtProfileID, tblProfiles.Description, tblProfiles.Type
FROM tblProfiles ORDER BY tblProfiles.txtProfileID, tblProfiles.Type;

The form also contains an unbound text box named RDIngPKIDDescription that
is populated according to a value selected in the combo box:
=[RDIngPKID].[Column](1)

How can I report the description?

The report queries tblProfiles.Description however this is the Control
Source for the text box named Description so I can't use it for the unbound
text box RDIngPKIDDescription. Essentially, I'm using Description twice in
the report. In the first usage it's relative to the value in txtProfileID and
in the second usage it's relative to the value in RDIngPKID.

Your help is greatly appreciated!
 
G

Guest

No. I'm not familiar with that function in reports. Could you please be more
specific?

Thanks!
 
R

Rick Brandt

JohnLute said:
No. I'm not familiar with that function in reports. Could you please
be more specific?

Thanks!

As its name implies the DLookup() function is used to "look up" a value from a
table or query. Basic usage is...

DLookup("FieldName", "TableName", "Optional Criteria")

Check the help file for details.
 
G

Guest

The Help file is useless. I plugged in "DLookUp" and it returned only one
topic which wasn't of any help.

I found this to be more useful:
http://support.microsoft.com/kb/208786

What I've come up with so far is this:
=DLookUp("[Description]","tblProfiles")

I'm at a loss regarding the criteria. How do I write this to display where
RDIngPKID = ?

Thanks!
 
W

Willem

I am getting a bit confused with all the names you use, but you could
try this:
=DLookUp("[Description]","tblProfiles", "[RDIngPKIDDescription ] = " &
[RDIngPKID])

You might have to use a semicolon (;) as a seperator instead of a
comma.
=DLookUp("[Description]";"tblProfiles"; "[RDIngPKIDDescription ] = " &
[RDIngPKID])
 
G

Guest

Thanks, Willem.

I've tried the first suggestion and it returns "Error#".

I've posted this problem several times and can't seem to work it out. Simply
put:

The field [tblProfiles].[Description] is used for two text boxes. One of the
fields is bound to [tblProfiles].[Description] and the other is unbound and
needs to display [tblProfiles].[Description] according to the value in
[RDIngPackID]. The value in [RDIngPackID] comes from
[tblProfiles].[txtProfileID]. Therefore, I had to rename the field to
[RDIngPackID]. The reason for this design is complicated and will only serve
to muddy the waters if I draw it all out.

I hope that makes sense!
 
W

Willem

I don't see how dlookup doesn't work. Maybe a syntax issue. You can
also go to the table design and fill out the LookUp tab of the
description Key fields. That way you will always see the descriptions
when you open the table (in a combo box).

Thanks, Willem.

I've tried the first suggestion and it returns "Error#".

I've posted this problem several times and can't seem to work it out. Simply
put:

The field [tblProfiles].[Description] is used for two text boxes. One of the
fields is bound to [tblProfiles].[Description] and the other is unbound and
needs to display [tblProfiles].[Description] according to the value in
[RDIngPackID]. The value in [RDIngPackID] comes from
[tblProfiles].[txtProfileID]. Therefore, I had to rename the field to
[RDIngPackID]. The reason for this design is complicated and will only serve
to muddy the waters if I draw it all out.

I hope that makes sense!

--
www.Marzetti.com


Willem said:
I am getting a bit confused with all the names you use, but you could
try this:
=DLookUp("[Description]","tblProfiles", "[RDIngPKIDDescription ] = " &
[RDIngPKID])

You might have to use a semicolon (;) as a seperator instead of a
comma.
=DLookUp("[Description]";"tblProfiles"; "[RDIngPKIDDescription ] = " &
[RDIngPKID])
 

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