dcount

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

Guest

I have a field in a report that uses a query called
"qryMPV_DateRange_SelectNurses_FromForm" in the dcount function.
I am using the dcount function in may different reports; with different
query names. Is there a way to tell dcount to use the query that is the
record source of the report? or do I have to repeat this query name in the
dcount function everytime it is used?

Text box Field example
=DCount("[II6]","qryMPV_DateRange_SelectNurses_FromForm","[II6]>0 and
[II6]<3 ")

Thanks for any ideas, CB
 
I have a field in a report that uses a query called
"qryMPV_DateRange_SelectNurses_FromForm" in the dcount function.
I am using the dcount function in may different reports; with different
query names. Is there a way to tell dcount to use the query that is the
record source of the report? or do I have to repeat this query name in the
dcount function everytime it is used?

Text box Field example
=DCount("[II6]","qryMPV_DateRange_SelectNurses_FromForm","[II6]>0 and
[II6]<3 ")

Thanks for any ideas, CB


As the control source of an unbound control?
No.

Using code? yes.
[SomeControl] =DCount("[II6]",Me.RecordSource,"[II6]>0 and [II6]<3 ")
 
Interesting idea. I have never tried that, but if you want to test it, here
is the syntax to return the name of the query:
Application.Reports("MyReportNameHere").RecordSource

As to technique, I would suggest you declare a module level variable to hold
the value and set it in the Open event.

At the top of the report's module:
Dim strQry as String

In the Open Event:

strQry = Application.Reports("MyReportNameHere").RecordSource
 

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

Access Dcount (multiple criteria) 3
Access Dcount function in access 0
Access MS Access DCount function problem 0
Dcount the values 0
Dcount problem 2
access report DCount function 4
Get Sums for 2 DCount fields on report 1
very slow report with dcount() 6

Back
Top