DCount in Text box from a parameter query

P

PD

I set up a report using a simple query as the control source. I used text
boxes with a DCount expression and it worked. I then added a parameter to
the query ie.[Enter Account Number], the query returns the correct
information but my Report text boxes (with DCount expressions) all say error?
 
P

PD

=DCount("[Cal]","Query for Inspection Type Report","[Cal] = 'Dec'")
--
PRD


Steve Schapel said:
PD,

What are the DCount expressions?

--
Steve Schapel, Microsoft Access MVP
I set up a report using a simple query as the control source. I used text
boxes with a DCount expression and it worked. I then added a parameter to
the query ie.[Enter Account Number], the query returns the correct
information but my Report text boxes (with DCount expressions) all say error?
 
S

Steve Schapel

PD,

Thanks. Ok, is "Query for Inspection Type Report" the name of the query
that the report is based on? If so, it makes sense that Access can't
evaluate the DCount if there is an unevaluated Parameter.

One approach would be to forget the Parameter Query idea altogether, and
instead put an unbound terxtbox on a form which the user can use to
enter the Account Number. Then, in the query, replace the parameter
prompt with a reference to the textbox, using syntax such as...
[Forms]![NameOfForm]![NameOfTextbox]

In fact, I would recommmend doing this in any case.

Then, you could further simplify by changing the expression for your Dec
textbox to like this...
=-Sum([Cal]='Dec')
 
P

PD

Ah ha!
Perfect and thank you very much.
--
PRD


Steve Schapel said:
PD,

Thanks. Ok, is "Query for Inspection Type Report" the name of the query
that the report is based on? If so, it makes sense that Access can't
evaluate the DCount if there is an unevaluated Parameter.

One approach would be to forget the Parameter Query idea altogether, and
instead put an unbound terxtbox on a form which the user can use to
enter the Account Number. Then, in the query, replace the parameter
prompt with a reference to the textbox, using syntax such as...
[Forms]![NameOfForm]![NameOfTextbox]

In fact, I would recommmend doing this in any case.

Then, you could further simplify by changing the expression for your Dec
textbox to like this...
=-Sum([Cal]='Dec')

--
Steve Schapel, Microsoft Access MVP
=DCount("[Cal]","Query for Inspection Type Report","[Cal] = 'Dec'")
 

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

Top