473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Detect when toolbar button is clicked

Hi All,
When a user(s) click on the 'Apply Filter' toolbar button I want to
run some code before the 'apply filter' kicks off. That code is to
check to be sure that the user has selected a value in a perticular
field and if no value was selected then display a msgbox and then
execute the 'apply filter' else just execute the 'apply filter' so, i
think my question is;

how do I detect(vba code)when a standard toolbar button is clicked in
Access97?

thanks
bobh.
Nov 13 '05 #1
2 2063
Bob Hynes wrote:
Hi All,
When a user(s) click on the 'Apply Filter' toolbar button I want to
run some code before the 'apply filter' kicks off. That code is to
check to be sure that the user has selected a value in a perticular
field and if no value was selected then display a msgbox and then
execute the 'apply filter' else just execute the 'apply filter' so, i
think my question is;

how do I detect(vba code)when a standard toolbar button is clicked in
Access97?

thanks
bobh.


I haven't tested it but open the form's property sheet, select Events,
and see if the OnFilter or OnApplyFilter events will help you out.

Nov 13 '05 #2
Hi, Bob.

Detecting filters and filter events on a form can be tricky. Try the
following syntax in your form's OnCurrent event:

'***** Begin Code *****

Private Sub Form_Current( )

On Error GoTo ErrHandler

If (Me.FilterOn) Then
If (Nz(Me!ZipCode.Value, "") = "") Then
MsgBox "Please enter a value in the ZipCode field."
End If
End If

Exit Sub

ErrHandler:

MsgBox "Error in Form_Current( ) in" & vbCrLf & Me.Name & _
" form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

'***** End Code *****

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
"Salad" <oi*@vinegar.com> wrote in message
news:wf***************@newsread3.news.pas.earthlin k.net...
Bob Hynes wrote:
Thanks for the comment but I've tried the 'OnApplyFilter' event which
does not work in my case. I should have added to my note that I'm
using a Query-By-Form form and the 'OnApplyFilter' event does not
reconize that I have selected a value in any field in the detail
section which lead me to the assumption that the 'OnApplyFilter
happens before the form reconizes it has criteria in the detail
section.
bobh.

Salad <oi*@vinegar.com> wrote in message news:<J1*************@newsread3.news.pas.earthlink .net>...
Bob Hynes wrote:
Hi All,
When a user(s) click on the 'Apply Filter' toolbar button I want to
run some code before the 'apply filter' kicks off. That code is to
check to be sure that the user has selected a value in a perticular
field and if no value was selected then display a msgbox and then
execute the 'apply filter' else just execute the 'apply filter' so, i
think my question is;

how do I detect(vba code)when a standard toolbar button is clicked in
Access97?

thanks
bobh.

I haven't tested it but open the form's property sheet, select Events,
and see if the OnFilter or OnApplyFilter events will help you out.


Well, maybe you can create a menu option that calls a function. Call it
ApplyFilter. Then your function can set values and perform actions.
See the Docmd.Runcommand in help for a list of constants for applying
the filter.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raymond H. | last post by:
Bonjour, Est-il possible d'exécuter seulement un msgbox dans l'événement clik d'une ToolBar mais sans que le bouton en question (de la ToolBar) ne s'enfonce mais reste normal sans enfoncement ?...
0
by: Jim Mitchell | last post by:
I am using the following code to trap the onclick event for the Toolbar Webcontrol. The problem is that I have no way to tell which button on the toolbar was clicked. Any ideas? Thanks in...
8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
5
by: Quinn | last post by:
When users clicked a unkown mime type link such as Zip on my website, a "Save/Open/Cancel" dialog box pops up. Is there a way to detect which button users clicked by using ASP? actually I only what...
2
by: Ashish | last post by:
Hello, I am sick and tired of ochestrating server and client side scripts. Basically I am using toolbar from IE web controls and want to attach javascript to one of the buttons' click event. The...
5
by: Stewart | last post by:
Pressing a Save Button on a Toolbar will not bind or validate the last value entered in a text box. I have found that when clicking on the Toolbar the focus in the binded text box does not leave. ...
5
by: BenCoo | last post by:
Hello everyone, I've a form with a groupbox witch contain 4 buttons. I searching for a solutions to detect when I click on one of the buttons returning a reference to the button thas has been...
3
by: Simon Verona | last post by:
I have a parent form which contains a toolbar. The toolbar controls the loading and switching to of MDI child forms. The code for the toolbar click event and one of the subroutines that loads...
4
by: Gerhard | last post by:
I have an MS Access app with multiple forms. One of the forms has a Toolbar (MsComctlLib.Toolbar) and it works as advertised. I handle the buttons in the Toolbar1_ButtonClick event. I would like...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.