Binding a field to variable query... possible ?

  • Thread starter Thread starter Alex T
  • Start date Start date
A

Alex T

Folks

I'd like to display a field in a form which value is the result of a
SELECT count( ... ) statement.

For instance I have a Parent <-> Child table structure and I'd like to
display in a form the count of the number of Child records that meet a
given criteria for the current Parent record.

I have a working query taking as a parameter the Parent table primary
key... but how do I bind the field to that query ? What syntax should
I use ? And yes, I'd rather avoid any VBA if possible...

Thanks & regards

--AlexT
 
Alex said:
Folks

I'd like to display a field in a form which value is the result of a
SELECT count( ... ) statement.

You can set the controlsource for the control to

=DCount("*", "yourtable","yourwhereclause")

I think that is the way to go here.
 
=DCount("*", "yourtable","yourwhereclause")

Did not think about that one... Thanks...

Would that work regardless of the underlying database (i.e. SQL server) ?

Regards

--AlexT
 
Alex said:
Did not think about that one... Thanks...

Would that work regardless of the underlying database (i.e. SQL server) ?

I suppose so. It does work with foxpro tables, for that matter :->
 
Back
Top