Need to populate a text box with query results ...

G

Guest

I want to populate a text box with output from a query without
having to redo the form.

I would like to display the department name
in the form. In the control source for this text field I entered something
like -

"=(select Department!Dept_Name from Department where
Department.Dept_code=[RequestingDept])"

I don't get the desired results. What am I doing wrong? Or is there any
better way to achieve this? The [RequestingDept] is one of the fields on this
form which contains the department code and maps to the linkded department
table.

Thank you,
-Me
 
G

Guest

Hi Me

Use DLookup instead

= Dlookup("Dept_Name","Department","Dept_code= " & [RequestingDept])

If the Dept_code field type is text, the use this
= Dlookup("Dept_Name","Department","Dept_code= '" & [RequestingDept] & "'")
 
G

Guest

Hi Ofer,

Thank you very much!
-Me

Ofer said:
Hi Me

Use DLookup instead

= Dlookup("Dept_Name","Department","Dept_code= " & [RequestingDept])

If the Dept_code field type is text, the use this
= Dlookup("Dept_Name","Department","Dept_code= '" & [RequestingDept] & "'")

--
\\// Live Long and Prosper \\//
BS"D


Me said:
I want to populate a text box with output from a query without
having to redo the form.

I would like to display the department name
in the form. In the control source for this text field I entered something
like -

"=(select Department!Dept_Name from Department where
Department.Dept_code=[RequestingDept])"

I don't get the desired results. What am I doing wrong? Or is there any
better way to achieve this? The [RequestingDept] is one of the fields on this
form which contains the department code and maps to the linkded department
table.

Thank you,
-Me
 

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