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 and Search button not work in Access 2007
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. |
#2
|
|||
|
|||
Filter and Search button not work in Access 2007
"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. |
#3
|
|||
|
|||
Filter and Search button not work in Access 2007
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. |
#4
|
|||
|
|||
Filter and Search button not work in Access 2007
"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. |
#5
|
|||
|
|||
Filter and Search button not work in Access 2007
"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. |
#6
|
|||
|
|||
Filter and Search button not work in Access 2007
"Jerry Whittle" wrote in message news 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. |
Thread Tools | |
Display Modes | |
|
|