Goto next record in Extanded listbox

StuartDwight

Registered User.
Local time
Today, 20:40
Joined
Mar 22, 2001
Messages
12
Dear all,
Can anyone shead any light on this.
I have a Listbox with multiselect set to Extended.
It is used to select multiple records for a delete job.
It is also used to select a record for opening. It opens the last if more than one is selected (not ideal but it works).
The problem i'm having is that when I open the record I have a button that I want to open the next record in the Listbox.
I have managed to get it to highlight the record but it still opens the original. It works OK when the multiselect is set to None.
Here is the code.

IDnoIndex = Forms![FrmLookupScreen]![LstLookup].ListIndex
IDnoCount = Forms![FrmLookupScreen]![LstLookup].ListCount
If (IDnoCount - 1) = IDnoIndex Then
MsgBox "This is the last record in the search", , "CORS move"
Else
Forms![FrmLookupScreen]![LstLookup].Selected(IDnoIndex) = False
Forms![FrmLookupScreen]![LstLookup].Selected(IDnoIndex + 1) = True
DoCmd.Close acForm, "FrmClientView"
IDno = Forms![FrmLookupScreen]![LstLookup].Column(0)
DoCmd.OpenForm "FrmClientView", acNormal, , "ID = " & IDno
End If


Any Ideas out there.
 

Users who are viewing this thread

Back
Top Bottom