Access_guy49
Registered User.
- Local time
- Today, 18:38
- Joined
- Sep 7, 2007
- Messages
- 462
Hello all!
I'm running Access 2003, and I have a List box with "extended" multi select enabled.
My code:
Pretty Simple right?
Well the problem is, when I select my list items in the form, everything looks fine. Then I click the button to add those items to another list which fires this code. The problem is the if statement... it cycles through and doesn't ever register a true event in the if...
****HOWEVER****
The code after this code, unselects all the items, so the box looks unselected, if I then select the items AGAIN, and click the button all works well!.... anyone have any idea what might be happening?
Here is the entire code for the button
Thanks for the help
I'm running Access 2003, and I have a List box with "extended" multi select enabled.
My code:
Code:
Dim i As Integer
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
With Me.List26
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
AddtoBooking Me.RentalID, .ItemData(i)
End If
Next i
.Requery
Me.List_CurrentOrder.Requery
End With
Pretty Simple right?
Well the problem is, when I select my list items in the form, everything looks fine. Then I click the button to add those items to another list which fires this code. The problem is the if statement... it cycles through and doesn't ever register a true event in the if...
****HOWEVER****
The code after this code, unselects all the items, so the box looks unselected, if I then select the items AGAIN, and click the button all works well!.... anyone have any idea what might be happening?
Here is the entire code for the button
Code:
Dim i As Integer
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
With Me.List26
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
AddtoBooking Me.RentalID, .ItemData(i)
End If
Next i
.Requery
Me.List_CurrentOrder.Requery
End With
i = 0 'set i to zero for next loop
'This loop unselects all the selected values in the listbox on the right
For i = 0 To Me.List26.ListCount - 1
If List26.Selected(i) = True Then
List26.Selected(i) = False
End If
Next
Me.List_CurrentOrder.Requery
Me.List26.Requery
Thanks for the help