Is there a value a value in that listbox?

R

Robin

Hello,

I have a tab control (3 tabs) on which resides a subform per tab. I start
on Tab0 and move to Tab1 and the Case 1 below works. Same with Case 2 below.
But when I return to Tab0 nothing happens, regardless of the items
highlighed in the various listboxes on the subform.

The Code:
Select Case Me.tabSubC
Case 0
If Me.lstCSsubCe.Value <> Null Then
If Me.lstCAsubCe.Value <> Null Then
If Me.lstCRsubCe.Value <> Null Then
If Me.lstCEsubCe.Value <> Null Then
Me.bSubC1.Caption = "View Engagement"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Add Engagement"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Add Assignment"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Add Return/Report"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Engagement Notes"
Me.bSubC5.Enabled = False
End If
Me.bSubC1.Caption = "View Return/Report"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Add Return/Report"
Me.bSubC2.Enabled = True
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Extend Return/Report"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Return/Report Notes"
Me.bSubC5.Enabled = True
End If
Me.bSubC1.Caption = "View Assignment"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Add Assignment"
Me.bSubC3.Enabled = True
Me.bSubC4.Caption = "Add Segment"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Assignment Notes"
Me.bSubC5.Enabled = True
End If
Me.bSubC1.Caption = "View Segment"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Add Segment"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Segment Notes"
Me.bSubC5.Enabled = True
End If
Case 1
Me.bSubC1.Caption = "Reserved"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Reserved"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Reserved"
Me.bSubC5.Enabled = False
Case 2
Me.bSubC1.Caption = "Reserved"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Reserved"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Reserved"
Me.bSubC5.Enabled = False
End Select

I have tried Not IsNull, ItemsSelected.Count <>0, <> Null, <> "" and others!
Please help.

Thank you,
Robin
 
R

ruralguy via AccessMonster.com

In what event is this code? If you use
Len([YourControl] & "") = 0
...you take care of both Null and a ZLS.
 
R

Robin

The code is in the tabSubC_Change() event. I tried your solution and at
least something is happening but not what I want. The way this works is:

1 click on a choice in the lstCEsubCe listbox -> lstCRsubCe & lstCAsubCe
populate with choices and bSubC1-5.captions change.
2. click on a choice in the lstCAsubCe listbox -> lstCSsubCe populates with
choices and bSubC1-5.captions change.
3. user clicks to another tab then clicks back to original tab. The choices
in the listboxes are still highlighed as they were when user left the tab,
but, now using your expression in all my IF statements, listbox lstCSsubCe is
ALWAYS treated as having a value even when the listbox is empty (no choices
visible).

Any ideas?

Thanks for your help,
Robin


ruralguy via AccessMonster.com said:
In what event is this code? If you use
Len([YourControl] & "") = 0
...you take care of both Null and a ZLS.
Hello,

I have a tab control (3 tabs) on which resides a subform per tab. I start
on Tab0 and move to Tab1 and the Case 1 below works. Same with Case 2 below.
But when I return to Tab0 nothing happens, regardless of the items
highlighed in the various listboxes on the subform.

The Code:
Select Case Me.tabSubC
Case 0
If Me.lstCSsubCe.Value <> Null Then
If Me.lstCAsubCe.Value <> Null Then
If Me.lstCRsubCe.Value <> Null Then
If Me.lstCEsubCe.Value <> Null Then
Me.bSubC1.Caption = "View Engagement"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Add Engagement"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Add Assignment"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Add Return/Report"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Engagement Notes"
Me.bSubC5.Enabled = False
End If
Me.bSubC1.Caption = "View Return/Report"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Add Return/Report"
Me.bSubC2.Enabled = True
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Extend Return/Report"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Return/Report Notes"
Me.bSubC5.Enabled = True
End If
Me.bSubC1.Caption = "View Assignment"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Add Assignment"
Me.bSubC3.Enabled = True
Me.bSubC4.Caption = "Add Segment"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Assignment Notes"
Me.bSubC5.Enabled = True
End If
Me.bSubC1.Caption = "View Segment"
Me.bSubC1.Enabled = True
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Add Segment"
Me.bSubC4.Enabled = True
Me.bSubC5.Caption = "Segment Notes"
Me.bSubC5.Enabled = True
End If
Case 1
Me.bSubC1.Caption = "Reserved"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Reserved"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Reserved"
Me.bSubC5.Enabled = False
Case 2
Me.bSubC1.Caption = "Reserved"
Me.bSubC1.Enabled = False
Me.bSubC2.Caption = "Reserved"
Me.bSubC2.Enabled = False
Me.bSubC3.Caption = "Reserved"
Me.bSubC3.Enabled = False
Me.bSubC4.Caption = "Reserved"
Me.bSubC4.Enabled = False
Me.bSubC5.Caption = "Reserved"
Me.bSubC5.Enabled = False
End Select

I have tried Not IsNull, ItemsSelected.Count <>0, <> Null, <> "" and others!
Please help.

Thank you,
Robin
 
R

ruralguy via AccessMonster.com

Have you single stepped the code to see what is really happening?
The code is in the tabSubC_Change() event. I tried your solution and at
least something is happening but not what I want. The way this works is:

1 click on a choice in the lstCEsubCe listbox -> lstCRsubCe & lstCAsubCe
populate with choices and bSubC1-5.captions change.
2. click on a choice in the lstCAsubCe listbox -> lstCSsubCe populates with
choices and bSubC1-5.captions change.
3. user clicks to another tab then clicks back to original tab. The choices
in the listboxes are still highlighed as they were when user left the tab,
but, now using your expression in all my IF statements, listbox lstCSsubCe is
ALWAYS treated as having a value even when the listbox is empty (no choices
visible).

Any ideas?

Thanks for your help,
Robin
In what event is this code? If you use
Len([YourControl] & "") = 0
[quoted text clipped - 87 lines]
 
R

Robin

Well...uh..er...I don't know how.
The only debugging tool I've ever used is a MsgBox inserted at various points!

I'll try the "Step Into".
Thanks,
Robin

ruralguy via AccessMonster.com said:
Have you single stepped the code to see what is really happening?
The code is in the tabSubC_Change() event. I tried your solution and at
least something is happening but not what I want. The way this works is:

1 click on a choice in the lstCEsubCe listbox -> lstCRsubCe & lstCAsubCe
populate with choices and bSubC1-5.captions change.
2. click on a choice in the lstCAsubCe listbox -> lstCSsubCe populates with
choices and bSubC1-5.captions change.
3. user clicks to another tab then clicks back to original tab. The choices
in the listboxes are still highlighed as they were when user left the tab,
but, now using your expression in all my IF statements, listbox lstCSsubCe is
ALWAYS treated as having a value even when the listbox is empty (no choices
visible).

Any ideas?

Thanks for your help,
Robin
In what event is this code? If you use
Len([YourControl] & "") = 0
[quoted text clipped - 87 lines]
Thank you,
Robin
 
R

ruralguy via AccessMonster.com

You can set a breakpoint by clicking outside the left margin. Then when the
code stops you advance with the F8 key. Hovering over variables will display
their value.
Well...uh..er...I don't know how.
The only debugging tool I've ever used is a MsgBox inserted at various points!

I'll try the "Step Into".
Thanks,
Robin
Have you single stepped the code to see what is really happening?
[quoted text clipped - 21 lines]
 

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