Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access 2007 ListBox question

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
0
0
US
I have my listbox multi-select property set to 'None' but cannot come up with a code snippet to test if the listbox is empty. All my code keeps giving me a value of 1 when empty. I do have the Show Columns property set to 'No'. When there's no rows showing in it, I would like to have my code return the value of 0.

Thanks for any help you can provide.
 
All my code keeps giving me a value of 1 when empty
Which code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Code I have tried:

z = me.mylistbox.listcount


OR:


With mylistboxName
For Each varitemsA In .ItemsSelected
a = a + 1
Next varitemsA
End With

If a = 0 Then
DoCmd.Hourglass False
Beep
MsgBox "xxxxxxxx.", 48, "System message"
Exit Sub
Else
End If
 
I'd try this:
If mylistboxName.ListIndex < 0 Then

Or this:
If IsNull(mylistboxName) Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top