Reports can fields call SQL queries?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to do something that I'm not sure you can do - I
want field on a report have the Control Source of
something like this:

select count([empno]) from employees
where date <> null

Can you do that in a control source for a field in a
report, I'm thinking its too easy - but I figured I'd ask
as it ain't working. thanks.
 
Yes, you can use the DLookup function. The syntax in the
control source of your object is =Dlookup("Name of
column","name of source table/view","where clause")

Hope this helps.

Don
 
You don't tell us if you want to use an Access query or a SQL pass-through
query; as there are some differences beetween them.

If you want something like the number of days that each employees as worked,
then something like this could help you:

select empno, count (*) as cnt from employes where date is not null
group by empno

This should work both for Access and SQL. Also, for SQL pass-through query,
there is no signification for setting a parameter inside the fonction
Count() other than an asterisk.

S. L.
 
Back
Top