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

  • Thread starter Thread starter BobC
  • Start date Start date
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?).
 
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.
 
Back
Top