|
-
Nov 22nd, 2000, 05:31 AM
#1
Thread Starter
Fanatic Member
I can’t think properly this morning (Rio has left!!!!).
I have a check box on a form.
Code is:
Code:
Private Sub chkList_Click()
If IsReflectionsOpen = False Then
MsgBox "Liar!"
chkList = False
Else
MsgBox "OK, you're right"
End If
End Sub
(The function IsReflectionsOpen checks if another totally unrelated program is open or not)
My problem is that when the user clicks chkList (which is defaulted to False), it runs IsReflectionsOpen, and when that is finished and the check box is set to False, is runs IsReflectionsOpen again.
Now, I could solve my problems by using a command button, but I’m stubborn, OK?
Suggestions please…
-
Nov 22nd, 2000, 06:14 AM
#2
Conquistador
rbc stands for raised by code.
Code:
Dim Rbc As Boolean
If Not Rbc Then
If Not IsReflectionsOpen Then
MsgBox "Liar!"
Rbc = True
chkList = False
Else
MsgBox "OK, you're right"
End If
Else
Rbc = False
End If
tell me if this helps you.
-
Nov 22nd, 2000, 06:28 AM
#3
Fanatic Member
You obviously need some beer, urgently.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 22nd, 2000, 06:30 AM
#4
Thread Starter
Fanatic Member
David
Thanks for the response. I can see where you are coming from, but it doesn’t work. As the checkbox is set to false again (after is has been determined that IsReflectionsOpen is false), it emulate an OnClick event, thus running the code again.
I suspect I need to store a variable outside of this sub….
Keep them coming!
Thanks again
Gaff
-
Nov 22nd, 2000, 06:32 AM
#5
Thread Starter
Fanatic Member
Paul,
Its about that time of day, isn't it. BTW, no banana with me today. Just a v v v pink tie (a la Larry Grayson)
-
Nov 22nd, 2000, 07:17 AM
#6
The rbc variable will have to be either module level, or stored as a static variable inside the sub.
- gaffa
-
Nov 23rd, 2000, 12:50 AM
#7
Conquistador
yeah, sorry that was the idea
you have to put Dim Rbc as Boolean in your General DEclarations part and then it will work
-
Nov 23rd, 2000, 12:52 AM
#8
Conquistador
Code:
'General Declarations
Dim Rbc As Boolean
'Check Box function
Private Sub chkList_OnClick()
If Not Rbc Then
If Not IsReflectionsOpen Then
MsgBox "Liar!"
Rbc = True
chkList = False
Else
MsgBox "OK, you're right"
End If
Else
Rbc = False
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|