Setting variables in VB for use in queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon,

This is probably really simple but I can't get it.

I'm building a VB module where I want to set a date and then it runs a
couple of queries that use that date as a variable.

How do I do this?

Thanks,

Tom.
 
You can use a function (public, defined in a standard module, not in a
class, not in a form), but not a variable. Have a function returning the
variable, as result of the function.



Hoping it may help,
Vanderghast, Access MVP
 
Hmmm I see. Well I don't know anything about using functions in VB.

In that case is there an easy way to set a value on a form from VB and then
the query can lift that value. Even toggling it to the next value would work
for me.

Sorry, I'm an analyst trying to do a developer's job.

Tom.
 
Access queries cannot understand variables. You can put the date in a
control on the form and reference as:
[Forms]![FormName]![ControlName]

Or, you can imbed a public function in a standard module, pass it a value,
and let the function return a value.
 
Back
Top