Yes, it was the focus. I started you off with the "Advance one Record" button code. Post back if you need further assistance.
Yes, it was the focus. I started you off with the "Advance one Record" button code. Post back if you need further assistance.
Many thanks RuralGuy,
It's ok now, but how to I can off message table when select end of record and click next button
I want to show order number selected record in total record ...
Change this line:
If .ListIndex < .ListCount Then
...to:
If .ListIndex < .ListCount -1 Then
I'm pretty sure the ListCount is 0 based.
Dear RuralGuy
I want t off message table below when select end of record and click next button
You've used the ListIndex property incorrectly ((please see the image))
and I want to show order number selected record in total record ... (please see the image)
Close messagebox: You've used the ListIndex property incorrectly
Change code line:
I want to show order number selected record in total record ... (as image below)Code:Err_gotoNext_Click: 'MsgBox Err.Description MsgBox "End Record" Resume Exit_gotoNext_Click
![]()
Goto last record in listbox access
First record:Code:Private Sub gotoLast_Click() If Me!lstItems.ListCount > 0 Then Me!lstItems = Me!lstItems.ItemData(Me!lstItems.ListCount - 1) End If End Sub
current recordCode:Private Sub gotoFirst_Click() 'Me.lstItems.Selected(0) = True Me.lstItems.SetFocus Me.lstItems.ListIndex = 0 End Sub
total record:Code:=[lstItems]. [ListIndex]+1
Done,Code:="of " & [lstItems]. [ListCount]
Many thanks RuralGuy
Last edited by uronmapu; 06-10-2012 at 07:42 AM.
Excellent! Thanks for sharing.
How to make a notifications when going to the last record or back to the first record
Previous Button is ok
Next button not okCode:Private Sub gotoPrevious_Click() On Error GoTo Err_gotoPrevious_Click With Me.lstItems .SetFocus If .ListIndex < .ListCount Then .ListIndex = .ListIndex - 1 MsgBox "First Contact", , "First Contact" End If End With Exit_gotoPrevious_Click: Exit Sub Err_gotoPrevious_Click: 'MsgBox Err.Description 'MsgBox "End the Record" Resume Exit_gotoPrevious_Click End Sub
Code:Private Sub gotoNext_Click() On Error GoTo Err_gotoNext_Click With Me.lstItems .SetFocus If .ListIndex < .ListCount Then .ListIndex = .ListIndex + 1 'MsgBox "End the Contact", , "End the Contact" End If End With Exit_gotoNext_Click: Exit Sub Err_gotoNext_Click: MsgBox Err.Description Resume Exit_gotoNext_Click End Sub