Constants used in query criteria

  • Thread starter Thread starter Dave Griffiths
  • Start date Start date
D

Dave Griffiths

Can anyone help me to do the following - I want to create a system wide
constant that I can use as part of a series of query crieria?

I tried putting the line - public const kkTest as long = 10 - in a module
but when I try to put something like - >kktest - in a criteria then
kktest gets automatically surrounded by speech marks and is treated as a
string

Any help much appreciated
Dave
 
I tried putting the line - public const kkTest as long = 10 - in a module
but when I try to put something like - >kktest - in a criteria then
kktest gets automatically surrounded by speech marks and is treated as a
string

VBA and SQL are two separate domains - VBA variables are not
accessible to SQL queries.

Two suggestions:

- Put the kkTest value in a Table and eitehr link it as part of your
query, or use DLookUp() to find it as a criterion

- Write a dumb little function to get the variable:

Public Function GetKKTest() As <appropriate datatype>
GetKKTest = kkTest
End Function

and use GetKKTest() in your criterion.
 
Back
Top