OK. I think I figured out what I'm supposed to do. In the query itself,
I
put "Between [Forms]![fGetStats]![tbxBegDate] And
[Forms]![fGetStats]![tbxEndDate]" (no quotes) as a parameter. Then, when
I
open the "parameterForm" ("fGetStats"), I'll input the desired dates and
click the cmdButton. On the click_event of the cmdButton, I open the
underlying form, which is based on the query. The trouble is, if I
manually
put the dates in the query, I get a count of 6. If I use this method, my
count is 0. So, I think I'm still goofed up.
Thanks, Karl. I have created a new form ("fGetStats"). After I get
the
input, how do I put that into the query? I understand you say I'll be
putting "Between [Forms]![fGetStats]![tbxBegDate] And
[Forms]![fGetStats]![tbxEndDate]" into the criteria for the various
queries, but I don't get how to do that. Do I do that with VBA?
I would not use 'Form_Load event' but just create two unbound textbox
to
enter your dates.
In the criteria of the query use ---
Between [Forms]![YourFormName]![YourTextbox1] And
[Forms]![YourFormName]![YourTextbox1]
Like I said replace replace form & textbox names with your names.
Open the form, enter dates, then run the query.
--
KARL DEWEY
Build a little - Test a little
:
Thank for the guidance, Karl.
So, I have made 2 global variables in the Form_Load event -- begDate
and
endDate. In the Form_Load event, from an inputbox, I get the value
for
the
year, which I then make into a date (begDate = ">#1/1/" & theYear &
"#").
In the parameter of the query (from which the form is based), I put
this
code:
[Forms]![myFormName]![begDate] And
<[Forms]![myFormName]![endDate]
On my form, I get the value 0 instead of 73[on the form, I am doing a
Count(*) of a textbox]. Do I have to use an SQL statement in my VBA
code,
somehow, instead of use a variable in my query parameter, or what?
You need to use an unbound textbox to enter the parameter.
In the query use this as criteria, replace form & textbox names
with
yours ---
[Forms]![YourFormName]![YourTextbox]
The above is for exact match criteria. For start of field use ---
Like [Forms]![YourFormName]![YourTextbox] & "*"
For match any part of field use ---
Like "*" & [Forms]![YourFormName]![YourTextbox] & "*"
--
KARL DEWEY
Build a little - Test a little
:
I want to use an inputbox in the Form_Load event, and then use
that
input
as
a parameter in several queries. Is that possible? How would I
put
the
input values in the queries? (My form uses the data from several
queries.)
TIA