Solved

Prevent checkbox click event occur while editing it in vb6

Posted on 2016-11-07
8
25 Views
Last Modified: 2016-11-07
When we fill our checkbox of our vb6 form when loading, the events are trigger and all the instructions of the event begins.

The code is for when a user checks on it, it saves to a table:

Private Sub Form_Load()
 check1.value=sql value saved previously
End Sub

Open in new window


Private Sub check1_Click()
 sql instruction save the state of the variable...
End Sub

Open in new window


However, before the screen is display, we read the table and set the checkbox according of what has been saved previously.  This trigger the "click" events and freezes the apps.

How can we set the checkbox without triggering the events?
0
Comment
Question by:rayluvs
  • 5
  • 3
8 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
Create a Boolean variable, set it to True when editing and False when done, and in the editing routing query the value of the Boolean and exit if True.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
That should be routine and not routing.
0
 

Author Comment

by:rayluvs
Comment Utility
Can you give an example?
0
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 500 total points
Comment Utility
Sure. Click a check box, click the "Start Edit Mode" button and then click the same or the other checkbox. Click the "End Edit Mode" button and click a checkxox.
28981520.zip
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:rayluvs
Comment Utility
We modified your code to present our problem.

We added 2 checkbox Check2 & check3

When the apps load, it sets the values in Check2 & check3 which causes the events of each click to be triggered.

What we want that when setting in form load, the events be disabled.

Set the stops at the check licks and you will see what we mean.

checkbox
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Add mbEditing = True right before Check2.Value = 1 in Form_Load.
0
 

Author Comment

by:rayluvs
Comment Utility
Yes, it worked!  Su[er obvious and didn't see it!

Thanx!
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now