-
OK heres the situation:
I am loading a file which is just a .MDB file with information needed to be placed on a form.
The form contains controls such as checkboxes and text boxes into which the information isloaded from the .MDB file.
It loads fine except for one problem.
On some of the controls have have MsgBox reminders that popup when a user does something...for example:
When the user clicks on checkbox1 the following message is displayed..
"Make sure you add x because you checked this box"
I want this message to appear when the user is using the program but not to appear when the user is loading the saved file which is the .MDB file.
My question is: Is there a way to disable the message boxes? To stop them from even appearing?...and API call or something that locks the screen prehaps.
I can just use a global boolean flag and set it to true while loading and then put a check on all the messages but this is messy....anyone know of another way?
-
There are several things that you can do (that I can think of), but none are as easy as the global boolean.
1. Add code to each checkbox and all other affected controls that says
Code:
Private Sub Check1_Click()
If Check1.Visible Then ' Screen.ActiveControl will return a
' trappable error if the control is not visible
If Screen.ActiveControl.Name = "Check1" Then
MsgBox "Make sure you add x because you checked this box"
End If
End If
End Sub
2. Create Properties in your form for each control with code like the following
Code:
Option Explicit
Private mint_Check1Value As Integer
Public Property Get Check1Value() As Integer
Check1.Value = mint_Check1Value
End Property
Public Property Let Check1Value(ByVal intValue As Integer)
'mint_Check1Value = your value from the database
End Property
And then do "Check1.Value = Check1Value" whenever it's convenient. (That code will exercise the Property Get and return the database value that was created when you loaded the data from the database into the Property Let.)
3. If you already have a Class in your project, add an IsLoading Let/Get Boolean property or create a new class that has that Property and use it just like you would use your global boolean. While this functions just like a Global variable it's more acceptable.
-
Excellent...thank you for the ideas.
Once again I bow to your superior knowledge :)