Hi,
I have a list box populated with record ID's all of which need a date field updated. I have been succesful at using the list box to update single records, but am not sure how to transfer this idea to work with multiple records simultaneously.
The code i am using is:
I have a list box populated with record ID's all of which need a date field updated. I have been succesful at using the list box to update single records, but am not sure how to transfer this idea to work with multiple records simultaneously.
The code i am using is:
Code:
Private Sub Command13_Click()
Dim i As Integer
Dim strSQL As String
Dim sMessage As String
Set db = CurrentDb()
Dim sTitle As String
For i = List10.ListCount - 1 To 0 Step -1
If List10.Selected(i) Then
sSQL = "UPDATE test0 SET test0.date2 = now() " & " WHERE test0.itemno = '" & i & "'"
sMessage = "Discontinue "
sTitle = "Continue..."
If MsgBox(sMessage, vbYesNo, sTitle) = vbYes Then
MsgBox sSQL
db.Execute (sSQL)
End If
End If
Next i
End Sub