From: Smitee2006 on
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.
From: 张小建 on


"Smitee2006" <Smitee2006(a)discussions.microsoft.com> 写入消息
news:F61A4853-DEC2-46C9-BA21-C2A0C892934F(a)microsoft.com...
> 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.

From: Jerry Whittle on
> 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.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Smitee2006" wrote:

> 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.
From: 张小建 on


"Smitee2006" <Smitee2006(a)discussions.microsoft.com> 写入消息
news:F61A4853-DEC2-46C9-BA21-C2A0C892934F(a)microsoft.com...
> 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.

From: 张小建 on


"Smitee2006" <Smitee2006(a)discussions.microsoft.com> 写入消息
news:F61A4853-DEC2-46C9-BA21-C2A0C892934F(a)microsoft.com...
> 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.