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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check selected item in Access listbox

Status
Not open for further replies.

SimonFinn

Programmer
Mar 13, 2003
130
GB
Hi

I need to check if a selected item in a listbox in access is the last item in the list using VBA.

Cheers Si
 
You need to put this code in the list box's Click event:
Code:
Private Sub List1_Click()
If List1.ListIndex = List1.ListCount - 1 Then
    MsgBox "This is the last item"
Else
    MsgBox "This is not the last item"
End If
End Sub
The ListIndex will show you the integer index value for the item 0 through ListCount-1.

Dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top