Queries

M

Marie

Iam trying to assign the result of a query to a field on
my form and using:

fieldname = 'Select etc. ' When I run the query the whole
select string gets put into the field on the form rather
than the result of the query. What am I doing wrong?

Thanks
 
M

Mark

Marie,

To assign results to a form's field, try using the Dcount,
Dmax, Dmin, Dfirst, or Dlast functions instead.

Mark
 
J

John Vinson

Iam trying to assign the result of a query to a field on
my form and using:

fieldname = 'Select etc. ' When I run the query the whole
select string gets put into the field on the form rather
than the result of the query. What am I doing wrong?

Thanks

Well... that is EXACTLY what you're asking it to do - assign the value
of a string constant to a field! That's no different than putting

fieldname = 'This is the string I want to see'

To retrieve a single value from a Query, either use that Query as the
Form's recordsource and bind the textbox to the desired field (of
which there might be hundreds - a query doesn't have just one value!);
or use the DLookUp function to look up a value in the query.
 
Top