Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by selection

Status
Not open for further replies.

baggyboy26

Technical User
Jun 12, 2008
19
GB
Ok, this is confusing me. I have a database that i need to disable menus etc in order to not confuse my users. One of which is filter by selection. I have used the button wizard to create a filter by selection button. This button does not work on my form but the filter by selection in the access toolbar works brilliantly. What gives? Here is the code behind the button.

Private Sub SelectFilt_Click()
On Error GoTo Err_SelectFilt_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_SelectFilt_Click:
Exit Sub

Err_SelectFilt_Click:
MsgBox Err.Description
Resume Exit_SelectFilt_Click

End Sub
 
Sorry Guys, sorted it! If anyone wants closure:

Each time you use the preposted code the control loses focus so access is unsure what to filter by. With a bit of thinking I replaced

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

with

Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdFilterBySelection

works much better!
 
How are ya baggyboy26 . . .

Just a suggestion ... how about using the fields [blue]On Dbl Click[/blue] event? ... no need for the button or resetting focus!

You could also add a [blue]tooltip[/blue] prompting [blue]Double-Click to filter![/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Genius!!!

Sometimes the answer stares you right in the face!!!

Thanks TheAceMan1
 
baggyboy26 . . .

BTW: Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and provides insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top