Connecting Tech Pros Worldwide Help | Site Map

Setting the result of SQL to a control

  #1  
Old April 14th, 2006, 10:05 PM
Karen Hill
Guest
 
Posts: 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.

  #2  
Old April 14th, 2006, 10:45 PM
fredg
Guest
 
Posts: n/a

re: Setting the result of SQL to a control


On 14 Apr 2006 13:57:01 -0700, Karen Hill wrote:
[color=blue]
> 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.[/color]

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
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
"error_reporting" setting not being recognized in my php.ini file laredotornado@zipmail.com answers 1 October 3rd, 2006 03:25 PM
V8 migration - Control Center errors Sean C. answers 4 November 12th, 2005 06:28 AM
Syntax to add records if primary key = list tom answers 8 September 24th, 2005 03:05 AM
forcing dbsqlexec to exit cleanly Gary answers 3 July 23rd, 2005 09:16 AM