A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filter Form doesn't close



 
 
Thread Tools Display Modes
  #1  
Old March 10th, 2010, 02:25 PM posted to microsoft.public.access.forms
CP[_2_]
external usenet poster
 
Posts: 18
Default 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  
Old March 11th, 2010, 01:17 AM posted to microsoft.public.access.forms
Barry A&P[_2_]
external usenet poster
 
Posts: 119
Default 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  
Old March 11th, 2010, 03:42 PM posted to microsoft.public.access.forms
CP[_2_]
external usenet poster
 
Posts: 18
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.