Referencing variables in queries

M

MattLe

I can set values for variables, but I can't figure out how
to call that variable from within queries or forms.

Seasonal start and end dates stored as variables, how do I
reference that in the criteria field of "RegisteredDate"
field in my query to only show dates between the start and
end dates.

Thank you.
 
M

Marshall Barton

MattLe said:
I can set values for variables, but I can't figure out how
to call that variable from within queries or forms.

Seasonal start and end dates stored as variables, how do I
reference that in the criteria field of "RegisteredDate"
field in my query to only show dates between the start and
end dates.


VBA variables are only available in VBA modules. You can
use Public Function (not Sub) procedures in standard modules
anywhere though. Putting that together means that you can
create a "wrapper" function for each variable that just
returns the variable's value.

You may find it easier/better to use hidden form text boxes
instead of variables.
 

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