How to fill a textbox with text and query result

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hello,

I want the user to know the category they are adding a record to by a text
box on a form.
If I put the control source of the text box as ="record is added to" & " "
I get the text plus a space. How do I add in the query result?

I tried
="record is added to" & " " & [qrytest].[subphasename]
="record is added to" & " " & [qrytest]![subphasename]
="record is added to" & " " & ([qrytest.subphasename])

I get the #Name error.
If I run the query it shows correctly, but I am missing something in the
syntax apparently.

thanks,
Rob
 
Rob said:
Hello,

I want the user to know the category they are adding a record to by a text
box on a form.
If I put the control source of the text box as ="record is added to" & " "
I get the text plus a space. How do I add in the query result?

I tried
="record is added to" & " " & [qrytest].[subphasename]
="record is added to" & " " & [qrytest]![subphasename]
="record is added to" & " " & ([qrytest.subphasename])

I get the #Name error.
If I run the query it shows correctly, but I am missing something in the
syntax apparently.


To get a value from a table/query, you have to open a
recordset. An easy way to retrive a single value is to use
the DLookup function which does that for you.

="record is added to " & DLookup("subphasename","qrytest")

That's probably not going to get what you want, but you
didn't explain enough for me to figure out what else you may
need to do.
 
Actually that works perfectly.
Thanks for the training.

Rob

Marshall Barton said:
Rob said:
Hello,

I want the user to know the category they are adding a record to by a text
box on a form.
If I put the control source of the text box as ="record is added to" & " "
I get the text plus a space. How do I add in the query result?

I tried
="record is added to" & " " & [qrytest].[subphasename]
="record is added to" & " " & [qrytest]![subphasename]
="record is added to" & " " & ([qrytest.subphasename])

I get the #Name error.
If I run the query it shows correctly, but I am missing something in the
syntax apparently.


To get a value from a table/query, you have to open a
recordset. An easy way to retrive a single value is to use
the DLookup function which does that for you.

="record is added to " & DLookup("subphasename","qrytest")

That's probably not going to get what you want, but you
didn't explain enough for me to figure out what else you may
need to do.
 
Back
Top