L
Leslie Isaacs
Hello All
I have a table called [locums sessions] which includes the fields 'locdate'
and 'locname' and key (autonumber) field 'locserial'.
'locname' is the name of a locum doctor, and 'locdate' is the date on which
that doctor worked a session.
I want a query that will return ALL the records corresponding to the doctors
who are working one or more session today - i.e. where 'locdate' = Date().
e.g. if there is a record where 'locname' = "Dr Green" and 'locdate' =
today's date, I want the query results to include ALL the records where
'locname' = "Dr Green". But if there are no records for "Dr Green" with
today's date, I don't want the querty results to include any of his records.
I have tried the following query (which is called [qry_count_locums]) ...
SELECT [locums sessions].locdate, [locums sessions].locname, DCount("[locums
sessions]![locserial]","[locums sessions]","[locums
sessions]![locdate]=date() and [locums
sessions]![locname]=[qry_count_locums]![locname]") AS Expr1
FROM [locums sessions]
WHERE (((DCount("[locums sessions]![locserial]","[locums sessions]","[locums
sessions]![locdate]=date() and [locums
sessions]![locname]=[qry_count_locums]![locname]"))>0));
.... but this gives me the message (twice) "The expression you entered as a
query parameter prodused this error 'Microsoft Office Access can't find the
name qry_count_locums!locname you entered in the expression".
I'm sure this can be done - but can't seem to get it!
Hope someone can help.
Many thanks
Les
I have a table called [locums sessions] which includes the fields 'locdate'
and 'locname' and key (autonumber) field 'locserial'.
'locname' is the name of a locum doctor, and 'locdate' is the date on which
that doctor worked a session.
I want a query that will return ALL the records corresponding to the doctors
who are working one or more session today - i.e. where 'locdate' = Date().
e.g. if there is a record where 'locname' = "Dr Green" and 'locdate' =
today's date, I want the query results to include ALL the records where
'locname' = "Dr Green". But if there are no records for "Dr Green" with
today's date, I don't want the querty results to include any of his records.
I have tried the following query (which is called [qry_count_locums]) ...
SELECT [locums sessions].locdate, [locums sessions].locname, DCount("[locums
sessions]![locserial]","[locums sessions]","[locums
sessions]![locdate]=date() and [locums
sessions]![locname]=[qry_count_locums]![locname]") AS Expr1
FROM [locums sessions]
WHERE (((DCount("[locums sessions]![locserial]","[locums sessions]","[locums
sessions]![locdate]=date() and [locums
sessions]![locname]=[qry_count_locums]![locname]"))>0));
.... but this gives me the message (twice) "The expression you entered as a
query parameter prodused this error 'Microsoft Office Access can't find the
name qry_count_locums!locname you entered in the expression".
I'm sure this can be done - but can't seem to get it!
Hope someone can help.
Many thanks
Les