Problems with a Form's behaviour

S

Stuart

I would be grateful for help to resolve the following problem, please:

I present a form for my users. The form contains 4 listboxes, Cancel
and OK buttons. The listboxes are populated by code behind the form.

The user is asked to highlight any of the 4 options that will apply. In
the case of listbox 1 this is a straightforward either/or question.
If user highlights either listbox 2, 3 or 4, then they are taken to
another form with a single listbox where they again opt to highlight or
not....different forms for the listbox 2, 3 and 4 questions.

If user only chooses the original listbox 1 questions, then there
appear to be no problems. If they highlight listbox 2, 3 or 4 then after
they return to the original form, one of their original selections (in
either listbox 2, 3 or 4) will have been reset..........They can repeat
their steps and eventually they can exit the form with OK.

So the original form is called from the module, and code behind the
form populates the 4 listboxes. When either listbox 2, 3 or 4 is
highlighted, then a different form is presented with a single listbox,
and the user is then returned to the original form. When they have
made their selection, they hit OK to exit.

What I've found is this:

User highlights listbox1 then
highlights listbox2 and the listbox in the associated subform, then
highlights listbox3 and the listbox in the associated subform, then
highlights listbox4 and the listbox in the associated subform, then
they are returned to the original form.

Say at this point that all 4 listboxes are highligted (blue). They now
click OK to exit the form:

stepping through the code brings us to this point:
Private Sub OKButton_Click()
OKButton.Tag = "Selected"
CancelButton.Tag = ""
GetUserPrintOptions.Hide
End Sub

If I step through the above code, then I'm taken to:

Private Sub ListBox4_Change()
Me.Hide
GetUserPrintOptions.Hide
GetUserPrintBlankPagesOptions.Show
Unload GetUserPrintBlankPagesOptions
'GetUserPrintOptions.Show
Me.Show
End Sub

where End Sub is highlighted yellow. If I execute that line, then
I go to:

Private Sub ListBox3_Change()
Me.Hide
GetUserPrintOptions.Hide
GetUserPrintZeroPagesOptions.Show
Unload GetUserPrintZeroPagesOptions '''.Show
'GetUserPrintOptions.Show
Me.Show
End Sub .....again, this line highlighted

It now jumps to the start of the sub
Private Sub ListBox3_Change() and proceeds to run
that code again !!!

Can anyone help, please?

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top