Recommendation on how to use semi-fixed variables in a Query

B

BobC

I need to use about 8-10 variables that will only 'seldom' change in the
calculations of query fields. Because the variables will be used in
multiple expressions within the query, it would seem to be best to only
have to change them/it in just one location. Should I use a table? The
variables will all be numbers (if that makes a difference?).
 
A

Allen Browne

Simplest solution might be to build the SQL statement, embedding the
variables, at the time you need it.

This would be a piece of code to OpenRecordset() and retrieve the rows you
need, and concatenate the values into the string. You could then assign the
SQL statement to the RecordSource of a form or report, or the SQL property
of the QueryDef.
 

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