syntax error in query

G

Guest

In the default value of a field in a table I entered

SELECT Count(*) FROM (qselUserHitsTotal);

basically, I want to populate the field with the value returned by that
query, BUT, I get the following error

"The Syntax of the subquery in this expression is incorrect. Check the
subquery's syntax and enclose the subquery in parentheses."

Please advise what I've done wrong.
TIA
 
G

Guest

Thanks for that but now it says:

"unknown function 'DCount' in validation expression or default value on
'tblDate.HitsTotal' "

TIA
 
W

Wayne Morgan

Ok, this is in a table. It won't work there. You can use the expression
given in the Default Value of control on a form where that control is bound
to the field. You can use functions in the table, but not DCount(). To see
the list of functions that can be used this way in the table, click the ...
button to the right of the Default Value box (the cursor will need to be in
the box to see the button).

Setting the Default Value in the control will work just as well as setting
it in the table except that you'll have to remember to add it to each
control that is bound to this field if that control will be used when
creating a new record.
 
G

Guest

Hi Wayne - all works fine now, as ultimately I wanted the data on a form
(obviously, to show the no of hits), so this cuts out an unnecessary loop of
first populating a table. Thanks for the extra tips for tables - I'll look
into those.
James
 

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