473,830 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2094
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.co m> wrote in message
news:wf******** *******@newsrea d3.news.pas.ear thlink.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.co m> wrote in message news:<J1******* ******@newsread 3.news.pas.eart hlink.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.Runcomman d 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
2823
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 ? Car dans mon programme, lorsque je clique sur le point d'interrogation mon curseur change en point d'interrogation. Et si je clique sur la ToolBar avec ce point d'interrogatin je veux seulement afficher le msgbox d'aide qui explique le bouton de...
0
1345
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 advance. Private Sub Toolbar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Toolbar1.ButtonClick
8
7939
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 header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the same control. Is there anyone who has tried this before and knows why this is hapenning ??
5
8487
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 to record the "valid" click -- when Open/Save was clicked. Thanks ahead. Quinn
2
1816
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 problem is that button doesnt exposes attribute collection. I can attach javascript to whole toolbar but 1. it would defeat the purpose of only attaching client scripts to some buttons 2. i would have no means of identifying which button was...
5
1848
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. Therefore in this case not saving the last entry when saving. I am able to use the following code to get round the updating of the object from the field value with this code before saving Private m_Record As Customer ....... Private Sub...
5
4251
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 pressed. Thanks in advance, Benny
3
4392
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 and shows a child form is: Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick Dim btn As System.Windows.Forms.ToolBarButton For Each btn In...
4
3665
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 to be able to control the toolbar from another form. Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True does not work. Does anybody have any ideas how to do this? Gerhard
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10491
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10526
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9315
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7746
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.