DoCmd.RunSQL "UPDATE tblReportList SET tblReportList.rptAccess = 0 " & _
"WHERE (((tblReportList.userID)='" & Me.byUserID.Value & Me!lstemployees.ItemsSelected & "','""')"
'lstemployees is a listbox that contains a list of all reports.
'byUserID is the matching user name in tblReportList
Dim db As DAO.Database
Dim rs As Recordset
Set db = CurrentDb()
Dim strSQL As String
'Update Users Report Access Status. User can NOT Access Report(s).
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblReportList SET tblReportList.rptAccess = 0 " & _
"WHERE (((tblReportList.userID)='" & Me.lstemployees.Value & "'))"
Call MsgBox("This User does NOT have Access to the Selected Report(s).", vbExclamation, "No Report Access")
DoCmd.SetWarnings True
Sorry, my pc was getting an update, everything got real slow.
Old version working Hans, just new version is not. Sorry, I was working on may versions at the same time.
Apologies.
This OLD code works.
Dim strIn As String
Dim strSQL As String
Dim v As Variant
'Update Users Report Access Status. User can NOT Access Report(s).
If Me.lstemployees.ItemsSelected.Count = 0 Then
MsgBox "No reports selected!"
Exit Sub
End If
For Each v In Me.lstemployees.ItemsSelected
strIn = strIn & ",'" & Me.lstemployees.ItemData(v) & "'"
Next v
strIn = "(" & Mid(strIn, 2) & ")"
strSQL = "UPDATE tblReportList SET rptAccess = 0 WHERE UserID In " & strIn
CurrentDb.Execute strSQL, dbFailOnError