YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

CommandButton won't fire event Options · View
dwin
#1 Posted : Tuesday, October 11, 2011 11:29:07 PM
Rank: Newbie
Groups: Member

Joined: 10/11/2011
Posts: 4
Location: Vancouver
Hi,

I have a display with a CommandButton on it. In the properties windows it has its name listed and in the VB code I have the appropriate function for the Click event.

The CommandButton is named CmdAcknowledge and the following is the function:

Private Sub CmdAcknowledge_Click()
Exit Sub


The function never gets called and the same goes for all the buttons on the display. The same code however works for an earlier version of the file that doesn't include some new GUI additions. Why would the extra GUI affect my buttons from firing their events? Even when I try to create a new button and fire an event it doesn't work. If you could point me in any kind of direction that would be much appreciated. Thanks.



Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
squatty
#2 Posted : Wednesday, October 12, 2011 7:38:22 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
I've found that in some cases a display can become totally unresponsive(corrupt), what we normally do is copy everything from one display and paste it into a new display, including the VBA code, try this and lut us know.
dwin
#3 Posted : Wednesday, October 12, 2011 7:03:56 PM
Rank: Newbie
Groups: Member

Joined: 10/11/2011
Posts: 4
Location: Vancouver
I tried that approach with no luck. There are only two buttons on my display so what I did was try to add new buttons and assign macro's from a module to them and then just reference the display sheet everytime theres a Me. statement. The problem I'm having with this however is that it's telling me that the object reference is invalid or cannot be found. Under the Display Objects folder in my project, the display object is named "ThisDisplay", however when I look in the Object Browser, I only see a display object named "thisDisplay". It looks like that is the correct display object because it contains all the macro's that I would expect, but when I try to use this code it gives me the object library invalid message.


Dim disp As Display
Set disp = Application.ActiveProcBook.Displays.Item(thisDisplay)
disp.Refresh 'for example

Do you think that this is also due to the fact that the display is just corrupt? Thanks for the input.
RJK Solutions
#4 Posted : Wednesday, October 12, 2011 9:14:21 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Have you got any missing references (Tools -> References) or any strange references there that shouldn't be there?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
dwin
#5 Posted : Wednesday, October 12, 2011 9:36:45 PM
Rank: Newbie
Groups: Member

Joined: 10/11/2011
Posts: 4
Location: Vancouver
The version that isn't working has the exact same references as the version that does work. Good suggestion though.
squatty
#6 Posted : Thursday, October 13, 2011 7:35:45 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
dwin, in your module, did you use the Private or Public to define you routine
dwin
#7 Posted : Thursday, October 13, 2011 5:21:11 PM
Rank: Newbie
Groups: Member

Joined: 10/11/2011
Posts: 4
Location: Vancouver
Private but I tried Public and it it gives the same error.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.