Solved

Prevent checkbox click event occur while editing it in vb6

Posted on 2016-11-07
8
34 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 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 41877590
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 46

Expert Comment

by:Martin Liss
ID: 41877599
That should be routine and not routing.
0
 

Author Comment

by:rayluvs
ID: 41877622
Can you give an example?
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 500 total points
ID: 41877789
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:rayluvs
ID: 41877847
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 46

Expert Comment

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

Author Comment

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

Thanx!
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41877877
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

895 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

11 Experts available now in Live!

Get 1:1 Help Now