C
CP
Hi all. I have an Access 2007 form with a command button that does
this on the OnClick event:
DoCmd.RunCommand acCmdAdvFilterSort
The filtering form opens correctly and I'm able to specify my
criteria. If I right click and choose Apply Filter/Sort, the
filtering works BUT the filter form doesn't close. Instead, my Access
2007 form appears in front of it and gets the focus but the filtering
form stays open.
I'm using a customized ribbon and have tried two other ways to
accomplish this. The first is:
idMso = "ApplyFilter"
The second is a macro that runs a function with this code:
DoCmd.RunCommand acCmdApplyFilterSort
DoCmd.Close acForm, "frmQueryDesignFilter1"
(frmQueryDesignFilter1 = the name of my form + "Filter1" and it's what
I see at the top of the filtering form).
These don't close the filtering form either.
(Note: Another option I thought about was using DoCmd.ApplyFilter
"xxxx" where "xxxx" is the where clause to use when filtering. But
since users will specify their own criteria so the where clause
constantly changes, I haven't been able to figure out how to use it.
Don't know if that makes any difference....)
In Access 2003, I used this command to get into the filtering:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2,
acMenuVer70
and this one to do the filtering, close the filter form, and return to
my own form:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, ,
acMenuVer70
These did the trick in Access 2003 (even though they were out-of-date)
but obviously they don't work in Access 2007.
Filtering works correctly (and the filtering form closes as it should)
when I'm in Access 2007 using a plain vanilla database and form but
something must be differrent in my customized application. Hopefully
someone can point me in the right direction.
Thanks in advance. Carol.
this on the OnClick event:
DoCmd.RunCommand acCmdAdvFilterSort
The filtering form opens correctly and I'm able to specify my
criteria. If I right click and choose Apply Filter/Sort, the
filtering works BUT the filter form doesn't close. Instead, my Access
2007 form appears in front of it and gets the focus but the filtering
form stays open.
I'm using a customized ribbon and have tried two other ways to
accomplish this. The first is:
idMso = "ApplyFilter"
The second is a macro that runs a function with this code:
DoCmd.RunCommand acCmdApplyFilterSort
DoCmd.Close acForm, "frmQueryDesignFilter1"
(frmQueryDesignFilter1 = the name of my form + "Filter1" and it's what
I see at the top of the filtering form).
These don't close the filtering form either.
(Note: Another option I thought about was using DoCmd.ApplyFilter
"xxxx" where "xxxx" is the where clause to use when filtering. But
since users will specify their own criteria so the where clause
constantly changes, I haven't been able to figure out how to use it.
Don't know if that makes any difference....)
In Access 2003, I used this command to get into the filtering:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2,
acMenuVer70
and this one to do the filtering, close the filter form, and return to
my own form:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, ,
acMenuVer70
These did the trick in Access 2003 (even though they were out-of-date)
but obviously they don't work in Access 2007.
Filtering works correctly (and the filtering form closes as it should)
when I'm in Access 2007 using a plain vanilla database and form but
something must be differrent in my customized application. Hopefully
someone can point me in the right direction.
Thanks in advance. Carol.