If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Filter Form doesn't close
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. |
#2
|
|||
|
|||
Filter Form doesn't close
You could just hide the form forms!frmQueryDesignFilter1.visible = False 'then apply the filter DoCmd.RunCommand acCmdAdvFilterSort Barry "CP" wrote: 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. . |
#3
|
|||
|
|||
Filter Form doesn't close
Thanks, Barry, but I was totally going down the wrong path. I just
figured out that frmQueryDesignFilter1 wasn't a FORM, it was a QUERY (given the name because it is temporarily created from the form frmQueryDesign.). When I changed my code to: DoCmd.RunCommand acCmdApplyFilterSort DoCmd.Close acQuery, "frmQueryDesignFilter1" The filtering was done and the "filtering form" closed. Hooray! Thanks again. Carol. On Mar 10, 8:17*pm, Barry A&P wrote: You could just hide the form forms!frmQueryDesignFilter1.visible = False 'then apply the filter DoCmd.RunCommand acCmdAdvFilterSort Barry |
Thread Tools | |
Display Modes | |
|
|