Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use a Dlookup in a textbox 1

Status
Not open for further replies.

idd

Programmer
Apr 19, 2002
165
0
0
GB
Hi all,

Access 2000 user.

I have a form based on a table.

form name is FRM_Centre_Enq
Table name is TBL_Centre_Enq

the form displays all enquiries for a centre.

centre details are stored in another table called TBL_Centre

The form is filtered to display enquiries for a centre which was selected on a selection form.

for the title of the form FRM_Centre_Enq I would like to display the name of the centre.

something like

"Enquiries for centre "XXXXXX" "
where XXXXXX would be the name of the centre.

at the moment I can get it show the centre ID which is available from the underlying table.

the question is

How do I get it to show the centre name in the title. I think DLOOKUP is the function i need to use but dont know how to use it.

I have tried using it in a text box which will hold the rest of the title too.

at the moment I got

="Enquiries for Centre " & [Centre_ID]

what I want is something like this or an alternative solution.

="Enquiries for Centre " & dlookup([centre_Name],tbl_Centre,[centre_id] = me.centre_ID

can someone please help me.
thanks in advance

Idd
 
DanVlas

I tried what you suggested.

but all i'm getting in the control in form view now is

#Name?

I have checked the table name, field name, and criteria to see if theys have any spelling mistakes or typos but everything seems to match..

this is what I have put in letter for letter and punctuation etc.

="Enquiries for Centre " & DLookUp("[C_Name]","tbl_Centre","[centre_id] = " & [me].[centre_ID])


Slight changes from your code you will notice is the centre name it actually is called C_Name, I called it Centre_Name when asking the question to keep things simple.

the code is in the control source for a text box.

thanks in advance for any help.

Idd
 
Daniel,

thanks a million it works, I have never used the Dlookup function before, this was my first attempt. with your help I succeeded.

Idd
 
I have just benefited from your advice to delete the [me] also.
You have saved my day. A rainbow afro for you! [afro2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top