SQL into a labels caption ?

S

SpookiePower

I would like to put the result from an SQL into the caption of a label,
but it keeps showing the SQL sentenc insted and not the result. I can
see that the label thinks it is some text I want to show, but how can I
make it do what I want it to do ?

How I have tryed it -
label.caption ="select.......... ;"
 
J

John Spencer

You can't do it without using some VBA to set the caption. What is the
SQL statement and what do you expect it to return- one value, many
values from one record, one value from many records?

Where is this label - on a form or a report?

When do you expect it to get set?

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
N

Noëlla Gabriël

Hi there,

if it's a simple value you want to retrieve with the sql expression, you can
always use the DLookup function. Create a textbox and set the control source
property to:
=DLookup("Fieldname";"Tabel/Query name";"Criteria"). If you delete the
attached label, the textbox itself will show the value and function as
dynamic label.
 

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

Similar Threads


Top