Connecting Tech Pros Worldwide Help | Site Map

Setting the result of SQL to a control

 
LinkBack Thread Tools Search this Thread
  #1  
Old April 14th, 2006, 09:05 PM
Karen Hill
Guest
 
Posts: n/a
Default Setting the result of SQL to a control

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, 09:45 PM
fredg
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.