Kent Petty
New Member
- Joined
- Jan 3, 2005
- Messages
- 19
Hi all,
I’m having a little problem that I just can’t seem to resolve. It doesn’t keep my applications from being useful, but it is widespread and annoying to say the least. Here’s one specific example:
I have a form called “HazardsForm.” The form asks a series of questions looking for checkbox responses. Each of the checkboxes is linked to a cell reference on the worksheet. Let’s take, for example, the first question on the form. It includes a label displaying the word “Housekeeping,” and is then followed by three rating checkboxes. The first checkbox reads “Good” and is named “HousekeepinggoodformCB,” the second checkbox reads “Average" and is named “HousekeepingavgformCB,” and the third checkbox reads “Unsatisfactory” and is named “HousekeepingunsatformCB.” There is also a button associated with this question labeled “Show Comment” and is named “HousekeepingCommentButton.”
When any of the checkboxes are checked, the other checkboxes are programmed to be unchecked. Here is the code associated with the first checkbox labeled “Good”:
Private Sub HousekeepinggoodformCB_Click()
If HousekeepinggoodformCB.Value = True Then
HousekeepingavgformCB.Value = False
HousekeepingunsatformCB.Value = False
End If
End Sub
If the “Good” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False.”
Here is the code associated with the second checkbox labeled “Average”:
Private Sub HousekeepingavgformCB_Click()
If HousekeepingavgformCB.Value = True Then
HousekeepinggoodformCB.Value = False
HousekeepingunsatformCB.Value = False
End If
End Sub
If the “Average” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False.”
Here is the code associated with the third checkbox labeled “Unsatisfactory”:
Private Sub HousekeepingunsatformCB_Click()
If HousekeepingunsatformCB.Value = True Then
HousekeepinggoodformCB.Value = False
HousekeepingavgformCB.Value = False
HousekeepingCommentButton.Visible = True
HousekeepingUnsatForm.Show
Else
HousekeepingCommentButton.Visible = False
End If
End Sub
If the “Unsatisfactory” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False,” the “Comment Button” is shown, and a form named “HousekeepingUnsatForm” is shown. If the checkbox is turned off (the else statement) then the “Comment Button” is hidden.
This all works exactly as it should if I call up the form and manipulate the buttons. The problem comes when I either leave this form by calling another form, or closing the program altogether, and then recalling the form with another execution of the program. What happens is that it takes two clicks to make the first button I select on the form execute its code. Actually, in this case, if the form had been left with the “Unsatisfactory” button checked (keep in mind that when you click that button causing it to change to true, it calls another form), and I click one of the other checkboxes (for instance, the “Good” checkbox), then the form that is called by the “Unsatisfactory” button is run! If I then close that other form and work within the hazards form, it runs fine until I unload it or close the spreadsheet altogether and come back into it again.
I hope this is enough to describe the condition. It’s driving me nuts and I’m sure I’m missing something.
By the way, when I close or leave the form, I am performing an unload command, like this:
Private Sub CommandButton3_Click()
Unload Me
End Sub
The form is typically called in this fashion:
Private Sub CommandButton4_Click()
Unload Me
HazardsForm.Show
End Sub
Can anyone straighten me out?
Thanks much in advance,
Kent in Alaska
I’m having a little problem that I just can’t seem to resolve. It doesn’t keep my applications from being useful, but it is widespread and annoying to say the least. Here’s one specific example:
I have a form called “HazardsForm.” The form asks a series of questions looking for checkbox responses. Each of the checkboxes is linked to a cell reference on the worksheet. Let’s take, for example, the first question on the form. It includes a label displaying the word “Housekeeping,” and is then followed by three rating checkboxes. The first checkbox reads “Good” and is named “HousekeepinggoodformCB,” the second checkbox reads “Average" and is named “HousekeepingavgformCB,” and the third checkbox reads “Unsatisfactory” and is named “HousekeepingunsatformCB.” There is also a button associated with this question labeled “Show Comment” and is named “HousekeepingCommentButton.”
When any of the checkboxes are checked, the other checkboxes are programmed to be unchecked. Here is the code associated with the first checkbox labeled “Good”:
Private Sub HousekeepinggoodformCB_Click()
If HousekeepinggoodformCB.Value = True Then
HousekeepingavgformCB.Value = False
HousekeepingunsatformCB.Value = False
End If
End Sub
If the “Good” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False.”
Here is the code associated with the second checkbox labeled “Average”:
Private Sub HousekeepingavgformCB_Click()
If HousekeepingavgformCB.Value = True Then
HousekeepinggoodformCB.Value = False
HousekeepingunsatformCB.Value = False
End If
End Sub
If the “Average” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False.”
Here is the code associated with the third checkbox labeled “Unsatisfactory”:
Private Sub HousekeepingunsatformCB_Click()
If HousekeepingunsatformCB.Value = True Then
HousekeepinggoodformCB.Value = False
HousekeepingavgformCB.Value = False
HousekeepingCommentButton.Visible = True
HousekeepingUnsatForm.Show
Else
HousekeepingCommentButton.Visible = False
End If
End Sub
If the “Unsatisfactory” checkbox is clicked and has a value of “True,” then the other two checkboxes assume a value of “False,” the “Comment Button” is shown, and a form named “HousekeepingUnsatForm” is shown. If the checkbox is turned off (the else statement) then the “Comment Button” is hidden.
This all works exactly as it should if I call up the form and manipulate the buttons. The problem comes when I either leave this form by calling another form, or closing the program altogether, and then recalling the form with another execution of the program. What happens is that it takes two clicks to make the first button I select on the form execute its code. Actually, in this case, if the form had been left with the “Unsatisfactory” button checked (keep in mind that when you click that button causing it to change to true, it calls another form), and I click one of the other checkboxes (for instance, the “Good” checkbox), then the form that is called by the “Unsatisfactory” button is run! If I then close that other form and work within the hazards form, it runs fine until I unload it or close the spreadsheet altogether and come back into it again.
I hope this is enough to describe the condition. It’s driving me nuts and I’m sure I’m missing something.
By the way, when I close or leave the form, I am performing an unload command, like this:
Private Sub CommandButton3_Click()
Unload Me
End Sub
The form is typically called in this fashion:
Private Sub CommandButton4_Click()
Unload Me
HazardsForm.Show
End Sub
Can anyone straighten me out?
Thanks much in advance,
Kent in Alaska