passing query criteria to VBA code??

s0rtd

Registered User.
Local time
Tomorrow, 03:51
Joined
Apr 16, 2003
Messages
96
Hey guys, i am hoping someone will be able to help me out with this one.

I have a query which has a scheduled date field, and criteria on that filed to select the date range.

i am creating a form which depends on getting the value entered in the parameter box when the query is run.

is it possible to pass that value to my VBA code??
if so, please tell me how :)

i hope you guys understand what i mean...

cheer
Jurgen
 
How are you entering the criteria? If you have a form where the user fills in the dates and then clicks a button to run the query you can get the values from that form, if you don't close it. Or you can put the values in a global variables and refer to the variables. If you want to use variables then create them in a module with code like this:

Public varDate1 As Date
Public varDate2 As Date

Set the variables anywhere in the db with:

varDate1 = MyDate1
varDate2 = MyDate2

You can read the variables anywhere as well.

hth,
Jack
 
at the moment i am have the criteria on the query (not on a form)

this is what i have in nthe criteria field:

Between [From Date] And [To Date (Not Including)]


is there a way to grab the values entered then??


if its not possible to do it this way, how do i create the criteria in the form ?? ie: how do i tell the query to look at the txt boxes??
 
Last edited:
Jurgen,

Where did you get the [From Date] and [To Date]?

Did you type them into the criteria section?

The best way is to enter them on a form, then the query (and
anything else) can reference them as:

=Forms![Yourform]![YourField]

Wayne
 
cheers wayne, i will try it that way :)


should be sweet as...
 

Users who are viewing this thread

Back
Top Bottom