By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Setting the result of SQL to a control

P: n/a
I'd like to do this:

Me.text_control = "SELECT name FROM customer where [order_id] = 5;"

How is this done. It needs to work for Access versions 2000 and
greater. Thanks in advance for your help.

Apr 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 14 Apr 2006 13:57:01 -0700, Karen Hill wrote:
I'd like to do this:

Me.text_control = "SELECT name FROM customer where [order_id] = 5;"

How is this done. It needs to work for Access versions 2000 and
greater. Thanks in advance for your help.


Use a DLookUp in an UNBOUND text control:

=DLookUp("[NameField]","CustomerTable","[Order_ID] = 5")
Do you really have a field named "Name"?
Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Apr 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.