SQL into a labels caption ?

  • Thread starter Thread starter SpookiePower
  • Start date Start date
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.......... ;"
 
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
'====================================================
 
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.
 
Back
Top