Filter and Search button not work in Access 2007

S

Smitee2006

I have a form view where users can see a listing of all clients in datasheet
view. On this same form is a button that users can push to be prompted for a
client name or a portion of a client's name in order to search the listing
and have it filter down the results. Hitting the button and leaving the
prompt blank will return the full client listing again. This button no
longer works now that I am working in Access 2007. Anybody have any ideas
why this might be? I've included the button's
underlying code for information.

Private Sub FilterClient_Click()
On Error GoTo Err_FilterClient_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_FilterClient_Click:
Exit Sub

Err_FilterClient_Click:
MsgBox Err.Description
Resume Exit_FilterClient_Click

End Sub

Thanks in advance for assistance.
 
Å

å¼ å°å»º

Smitee2006 said:
I have a form view where users can see a listing of all clients in
datasheet
view. On this same form is a button that users can push to be prompted
for a
client name or a portion of a client's name in order to search the listing
and have it filter down the results. Hitting the button and leaving the
prompt blank will return the full client listing again. This button no
longer works now that I am working in Access 2007. Anybody have any ideas
why this might be? I've included the button's
underlying code for information.

Private Sub FilterClient_Click()
On Error GoTo Err_FilterClient_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_FilterClient_Click:
Exit Sub

Err_FilterClient_Click:
MsgBox Err.Description
Resume Exit_FilterClient_Click

End Sub

Thanks in advance for assistance.
 
J

Jerry Whittle

DoMenuItem

When Access changes, especially big changes like the Ribbon, there's really
no way to know if the menu items are going to be the same. acMenuVer70 is
suppose to keep it backwards compatible, but.....

Even worse is using SendKeys, but that's a different story.

Instead use RunCommand. The first command sets the focus on the text box
that you want to search.

Col1.SetFocus
DoCmd.RunCommand acCmdFind

One Second! What precisely isn't working: the find at all or the leaving it
blank part? You may need to set up the default find settings.

Check out Application.SetOption. Below are some I used in A97 databases but
they seem to work in A07 also..

'Set some database defaults found in Tools, Options
' Put in the Open event of the startup form
' Set Default Locking to Edited Record
Application.SetOption "Default Record Locking", 2
' Set Default Open Mode for Databases to Shared
Application.SetOption "Default Open Mode for Databases", 0
' Set Default Find/Replace Behavior to Start of Field Search
Application.SetOption "Default Find/Replace Behavior", 2


In the case of "Application.SetOption "Default Record Locking", 2" Default
Record Locking has three choices and the one I want is the third so, of
course, I put in 2 for the arguement. That's because it starts numbering at 0
instead of 1.

Put the above code in the Open Event of your opening form. One other strange
thing is that the database may need to be opened and closed twice on the
user's computer for the change to take effect. The first time the database
opens, it makes the changes. The second time the changes are in effect.
 
Å

å¼ å°å»º

Smitee2006 said:
I have a form view where users can see a listing of all clients in
datasheet
view. On this same form is a button that users can push to be prompted
for a
client name or a portion of a client's name in order to search the listing
and have it filter down the results. Hitting the button and leaving the
prompt blank will return the full client listing again. This button no
longer works now that I am working in Access 2007. Anybody have any ideas
why this might be? I've included the button's
underlying code for information.

Private Sub FilterClient_Click()
On Error GoTo Err_FilterClient_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_FilterClient_Click:
Exit Sub

Err_FilterClient_Click:
MsgBox Err.Description
Resume Exit_FilterClient_Click

End Sub

Thanks in advance for assistance.
 
Å

å¼ å°å»º

Smitee2006 said:
I have a form view where users can see a listing of all clients in
datasheet
view. On this same form is a button that users can push to be prompted
for a
client name or a portion of a client's name in order to search the listing
and have it filter down the results. Hitting the button and leaving the
prompt blank will return the full client listing again. This button no
longer works now that I am working in Access 2007. Anybody have any ideas
why this might be? I've included the button's
underlying code for information.

Private Sub FilterClient_Click()
On Error GoTo Err_FilterClient_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_FilterClient_Click:
Exit Sub

Err_FilterClient_Click:
MsgBox Err.Description
Resume Exit_FilterClient_Click

End Sub

Thanks in advance for assistance.
 
J

jenny molina

Jerry Whittle said:
When Access changes, especially big changes like the Ribbon, there's
really
no way to know if the menu items are going to be the same. acMenuVer70 is
suppose to keep it backwards compatible, but.....

Even worse is using SendKeys, but that's a different story.

Instead use RunCommand. The first command sets the focus on the text box
that you want to search.

Col1.SetFocus
DoCmd.RunCommand acCmdFind

One Second! What precisely isn't working: the find at all or the leaving
it
blank part? You may need to set up the default find settings.

Check out Application.SetOption. Below are some I used in A97 databases
but
they seem to work in A07 also..

'Set some database defaults found in Tools, Options
' Put in the Open event of the startup form
' Set Default Locking to Edited Record
Application.SetOption "Default Record Locking", 2
' Set Default Open Mode for Databases to Shared
Application.SetOption "Default Open Mode for Databases", 0
' Set Default Find/Replace Behavior to Start of Field Search
Application.SetOption "Default Find/Replace Behavior", 2


In the case of "Application.SetOption "Default Record Locking", 2" Default
Record Locking has three choices and the one I want is the third so, of
course, I put in 2 for the arguement. That's because it starts numbering
at 0
instead of 1.

Put the above code in the Open Event of your opening form. One other
strange
thing is that the database may need to be opened and closed twice on the
user's computer for the change to take effect. The first time the database
opens, it makes the changes. The second time the changes are in effect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top