Source of text box says "#Name?"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is really silly. I have a text box. I want to default value of the
text box to be the result of a query that will return only 1 value. And what
I get is "#Name?"

For example, I have a short table that has folks' logon IDs and their
corresponding full name. I have the code that gets a person's logon ID.
That's working fine. I have a query that uses that function and returns the
correct person's full name. But, when I use that query as the default value
of the text box, I get the garbage above.

What am I doing wrong?
 
You cannot use a query directly as the Controlsource of a textbox --
even if it only returns one value

instead, use dFirst

controlSource --> =dFirst("[columnname]","[Queryname]")


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Well, not sure what it didn't care for, but I needed to change it up a bit.
Here's what worked:

=DFirst("[columnName]","[TableName]","the WHERE portion of the SQL code
behind the query")

Thanks for steering me in the right direction!

strive4peace said:
You cannot use a query directly as the Controlsource of a textbox --
even if it only returns one value

instead, use dFirst

controlSource --> =dFirst("[columnname]","[Queryname]")


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


This is really silly. I have a text box. I want to default value of the
text box to be the result of a query that will return only 1 value. And what
I get is "#Name?"

For example, I have a short table that has folks' logon IDs and their
corresponding full name. I have the code that gets a person's logon ID.
That's working fine. I have a query that uses that function and returns the
correct person's full name. But, when I use that query as the default value
of the text box, I get the garbage above.

What am I doing wrong?
 
you're welcome ;) it is better to get rid of the query anyway -- and go
straight to the source!

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Well, not sure what it didn't care for, but I needed to change it up a bit.
Here's what worked:

=DFirst("[columnName]","[TableName]","the WHERE portion of the SQL code
behind the query")

Thanks for steering me in the right direction!

strive4peace said:
You cannot use a query directly as the Controlsource of a textbox --
even if it only returns one value

instead, use dFirst

controlSource --> =dFirst("[columnname]","[Queryname]")


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


This is really silly. I have a text box. I want to default value of the
text box to be the result of a query that will return only 1 value. And what
I get is "#Name?"

For example, I have a short table that has folks' logon IDs and their
corresponding full name. I have the code that gets a person's logon ID.
That's working fine. I have a query that uses that function and returns the
correct person's full name. But, when I use that query as the default value
of the text box, I get the garbage above.

What am I doing wrong?
 

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

Back
Top