Populate Text Box from different source

D

Diane

Report is generated by a query. I would like one of the text boxes to
populate the Name of Department corresponding to the Department No from a
different source (TblDepartments) instead of the query. I tried to use the
Dlookup as follows:
=DLookUp("[Name of Department]","[TblDepartments]","[Department
No]=Report![TblEmployeeInfoID]") but it doesn't work.

In the relationships, Department No (from TblDepartments) is related to ID
(from TblEmployeeInfo)

Why can't I use the =Dept.column(1) as I did on the form. That worked great,
but I guess it's different for a report?

Please help. Thanks.
 
D

Diane

It is still giving me an #error message on the report where the Department
name should appear

Marshall Barton said:
Diane said:
Report is generated by a query. I would like one of the text boxes to
populate the Name of Department corresponding to the Department No from a
different source (TblDepartments) instead of the query. I tried to use the
Dlookup as follows:
=DLookUp("[Name of Department]","[TblDepartments]","[Department
No]=Report![TblEmployeeInfoID]") but it doesn't work.

In the relationships, Department No (from TblDepartments) is related to ID
(from TblEmployeeInfo)

Why can't I use the =Dept.column(1) as I did on the form. That worked great,
but I guess it's different for a report?


The .Column thing works on a form because it's in a list or
combo box. Text boxes don't have columns so it doesn't
apply.

Your syntax for the DLookup you posted is incorrect. It
should be:

=DLookUp("[Name of Department]", "[TblDepartments]",
"[Department No]=Report![TblEmployeeInfo].[ID]")
 
D

Diane

Sorry Marsh, but I added the s to Report and it's still giving me the #error

Marshall Barton said:
Diane said:
It is still giving me an #error message on the report where the Department
name should appear

Marshall Barton said:
Diane wrote:

Report is generated by a query. I would like one of the text boxes to
populate the Name of Department corresponding to the Department No from a
different source (TblDepartments) instead of the query. I tried to use the
Dlookup as follows:
=DLookUp("[Name of Department]","[TblDepartments]","[Department
No]=Report![TblEmployeeInfoID]") but it doesn't work.

In the relationships, Department No (from TblDepartments) is related to ID
(from TblEmployeeInfo)

Why can't I use the =Dept.column(1) as I did on the form. That worked great,
but I guess it's different for a report?


The .Column thing works on a form because it's in a list or
combo box. Text boxes don't have columns so it doesn't
apply.

Your syntax for the DLookup you posted is incorrect. It
should be:

=DLookUp("[Name of Department]", "[TblDepartments]",
"[Department No]=Report![TblEmployeeInfo].[ID]")


Ahhh, I just noticed that ...=Report![TblEmp...
needs to be ...=Reports![TblEmp...
 

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