Solved

Using static values in MS Access update queries

Posted on 2013-01-11
2
339 Views
Last Modified: 2013-01-11
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.
0
Comment
Question by:MCaliebe
2 Comments
 
LVL 26

Accepted Solution

by:
jerryb30 earned 200 total points
ID: 38768786
DLookup("Num_val", "tbl_Static", "[Parameter] = 'cust_ct'") added to your source query, perhaps.
0
 

Author Closing Comment

by:MCaliebe
ID: 38768944
Thank you!  Worked perfect.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now