Link to home
Start Free TrialLog in
Avatar of MCaliebe
MCaliebeFlag for United States of America

asked on

Using static values in MS Access update queries

Can I get some advice on using static parameters in queries?

I have a DB which is using a query as the data source for a report.  One of the values needs to be a calculated field.  The calculated field uses a piece of the data from the source table for the query, and a single number.  

IMS:=[tbl_source].[cust_ct]/ (The Total of my available customers, currently 5123)

I can write statement as

IMS:=[tbl_source].[cust_ct]/5123

However, I don't like using static numbers in my queries.

I tried to build a table, tbl_static to house my static numbers

ID, Parameter, Num_Value
1, Cust_CT, 5123

And called for it using a sub query

IMS: [tbl_source].[cust_ct]/(select [tbl_Static].[Num_Value] from [tbl_Static] where [tbl_Static].[Parameter] = "cust_ct")

This works fine in a select query, however if I try to use this field on a report, I get an error stating "Multi-level Group By clause is not allowed in a Sub Query"

I don't have any grouping in the query, only in the report so I can't determine why I received this error.

I thought to do an update query and re-update the source table should the static data change, however I get the error that states "Operation must use an updateable query".

I can however use this statement to write tables.  Is that my only option...write new tables when the data changes and tie another table to the report query?

Thanks for you help.
ASKER CERTIFIED SOLUTION
Avatar of jerryb30
jerryb30
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MCaliebe

ASKER

Thank you!  Worked perfect.