Strange Happenings

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
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Thanks Dave. Actually, when I first started this project, I was using the hide command.....had the same problem then. I went to the unload because I end up calling about 50 different input forms and want to keep the memory a little freed up.

It's a strange problem....almost like the module is hung, and then resumes when you recall the form.....I'm stumped.

Again...thanks for the suggestion.

Cheers,

Kent
 
Upvote 0

Forum statistics

Threads
1,222,118
Messages
6,164,072
Members
451,870
Latest member
Nikhil excel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top