Parameter in a Query Problem

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

Guest

Hello,

I have a query that has a few fields in it along with a new parameter in
another column in the grid USING one of those named fields. For instance:

LastName
Errors: [LastName]
Total: [Errors] * 5

Everytime I run this query, I get an "enter parameter value" for "Errors"
but yet it does the calculation correctly. Any ideas?

Thank you,
MN
 
This could be a timing issue.

For example, if you have any criteria under this Total, Access has to
perform the calcuations to get the total, but it may not be able to get the
total until it has selected the records.

The solution is to repeat the entire expression instead of using the Errors
alias.
 
Well it's more complicated than that when it involves a totals query and it's
counting the number of instances of "LastName" - which is a text field. I.e.
Errors: [LastName] and then "Count" in the "Total" row.

Then a new field Totals: [Errors] *5

Any ideas?

Thanks
MN

Allen Browne said:
This could be a timing issue.

For example, if you have any criteria under this Total, Access has to
perform the calcuations to get the total, but it may not be able to get the
total until it has selected the records.

The solution is to repeat the entire expression instead of using the Errors
alias.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MacNut2004 said:
Hello,

I have a query that has a few fields in it along with a new parameter in
another column in the grid USING one of those named fields. For instance:

LastName
Errors: [LastName]
Total: [Errors] * 5

Everytime I run this query, I get an "enter parameter value" for "Errors"
but yet it does the calculation correctly. Any ideas?

Thank you,
MN
 
Switch the query to SQL View (View menu in query design.)

In the SELECT clause, you will see:
Count([LastName]) AS Errors,

You can add another field that looks like this:
Count([Lastname]) * 5 AS Totals

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MacNut2004 said:
Well it's more complicated than that when it involves a totals query and
it's
counting the number of instances of "LastName" - which is a text field.
I.e.
Errors: [LastName] and then "Count" in the "Total" row.

Then a new field Totals: [Errors] *5

Any ideas?

Thanks
MN

Allen Browne said:
This could be a timing issue.

For example, if you have any criteria under this Total, Access has to
perform the calcuations to get the total, but it may not be able to get
the
total until it has selected the records.

The solution is to repeat the entire expression instead of using the
Errors
alias.

MacNut2004 said:
Hello,

I have a query that has a few fields in it along with a new parameter
in
another column in the grid USING one of those named fields. For
instance:

LastName
Errors: [LastName]
Total: [Errors] * 5

Everytime I run this query, I get an "enter parameter value" for
"Errors"
but yet it does the calculation correctly. Any ideas?
 
Excellent. Thank you much!!

Allen Browne said:
Switch the query to SQL View (View menu in query design.)

In the SELECT clause, you will see:
Count([LastName]) AS Errors,

You can add another field that looks like this:
Count([Lastname]) * 5 AS Totals

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MacNut2004 said:
Well it's more complicated than that when it involves a totals query and
it's
counting the number of instances of "LastName" - which is a text field.
I.e.
Errors: [LastName] and then "Count" in the "Total" row.

Then a new field Totals: [Errors] *5

Any ideas?

Thanks
MN

Allen Browne said:
This could be a timing issue.

For example, if you have any criteria under this Total, Access has to
perform the calcuations to get the total, but it may not be able to get
the
total until it has selected the records.

The solution is to repeat the entire expression instead of using the
Errors
alias.

Hello,

I have a query that has a few fields in it along with a new parameter
in
another column in the grid USING one of those named fields. For
instance:

LastName
Errors: [LastName]
Total: [Errors] * 5

Everytime I run this query, I get an "enter parameter value" for
"Errors"
but yet it does the calculation correctly. Any ideas?
 
Back
Top