A
Arvin Meyer [MVP]
Compact it first, then zip it. My email address it at my website:
http://www.datastrat.com
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
http://www.datastrat.com
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Secret Squirrel said:Would it be possible for me to zip the DB up and email it to you? It might
be
easier if you could see how I have it set up.
Arvin Meyer said:The only possible explanation that I can easily see is that the
recordsource
for the form itself is not something like:
SELECT *
FROM MyTable
WHERE DivisionID=[Forms]![frmMyForm]![cboDivisions];
You must have code in the AfterUpdate event of cboDivisions which is
changing the recordsource. If that's the case, the AfterUpdate event
won't
fire unless you tell it to like:
Sub Form_Open(Cancel As Integer)
Me.cboMonthSelect.Value = Format(Date, "mmmm")
Me.cboDivisions.Requery
Me.cboDivisions.Value = 1
cboDivisions_AfterUpdate
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Secret Squirrel said:That's exactly what I'm looking to do. Here's what I put into my Open
event
of my form:
Me.cboMonthSelect.Value = Format(Date, "mmmm")
Me.cboDivisions.Requery
Me.cboDivisions.Value = 1
Me.Requery
But unfortunately it's still now working. It opens with all the records
and
cboMonthSelect box has "August" in it and the cboDivisons has "1" in
it.
But
it's still showing all the records.
:
You must be doing something incorrectly. It not only works I just
tested
it
with a double list box and it works just fine. To prove it download my
test
file at:
http://www.accessmvp.com/Arvin/Combo.zip
Then run the Products form and select the first list box, then the
second.
After you're satisfied, paste the following code into the form's Open
event,
save it, close and reopen it:
Private Sub Form_Open(Cancel As Integer)
Me.lstCategories.Value = 5
Me.lstProducts.Requery
Me.lstProducts.Value = 52
Me.Requery
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
message Still nothing. When I open my form it has the current month (August)
selected
since I have it as the default value. But it's still not filtering
the
records. But once I select it from the list it will filter.
:
Try :
Sub Form_Open(Cancel As Integer)
Me.cboMyCombo.Value = Format(Date, "mmmm")
Me.Requery
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
in
message I already have a select query for my records on this form. I'm
using
the
combo box to filter my records right now. Everything filters
properly
but
I
just want to have it filter to the current month when the form is
opened.
Will the after update event requery the records even if I don't
select
anything from the combo box since it is already defaulted to the
current
month?
Do I just put this on the after update event? Me.Requery
:
I would suggest you create a select query and use it as the
source
for
the
records, format the appropriate field to "mmmm", create a
criteria
in
the
field to reference the combo box and put in an after update
event
(in
the
combo) to requery the records.
I hope that makes sense.
let me know.
--
www.ae911truth.org
:
I have a combo box on my form header that I'm using to filter
my
data
by
month. The combo box has a list of the months and I have the
default
value
set to:
Format(Now(),"mmmm")
How do I get it to automatically filter my data to my default
value
when I
open the form? Right now it just shows the current month in my
combo
box but
it doesn't filter the records.