B
big.brown
Hello,
I am truly a novice and hope that you will be able to answer this
question.
Need: Save a list of members that are NOT selected in an Extended List
Box and indicate them as not present for a ConfType (conference type)
unless they are "excused" for a given date range already recorded in
another table.
My code is below and I do not know how to modify it to accomplish the
above need.
Thank you!
--------------------
Public Function CreateAttendanceRecords()
On Error GoTo Err_CreateAttendanceRecords_Click
Dim i, j, k As Variant
Dim dbs As Database
Dim rst As Recordset
Dim strSql As String
strSql = "SELECT RecordID, ResidentID, Date, ConfType FROM
TblAttendance;"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSql)
For Each i In Forms!frmAttendance!lstResidents.ItemsSelected
rst.AddNew
rst!ResidentID = Forms!frmAttendance!lstResidents.ItemData(i)
rst!Date = Forms!frmAttendance!Date
For Each j In Forms!frmAttendance!
lstConferenceTypes.ItemsSelected
rst!ConfType = Forms!frmAttendance!
lstConferenceTypes.ItemData(j)
Next j
rst.Update
Set rst = Nothing
MsgBox "Records Created"
Exit_CreateAttendanceRecords_Click:
Exit Function
Err_CreateAttendanceRecords_Click:
Select Case Err.Number
Case 3022 'ignore duplicate keys
Resume Next
Case Else
MsgBox Err.Number & "-" & Err.Description
Resume Exit_CreateAttendanceRecords_Click
End Select
End Function
I am truly a novice and hope that you will be able to answer this
question.
Need: Save a list of members that are NOT selected in an Extended List
Box and indicate them as not present for a ConfType (conference type)
unless they are "excused" for a given date range already recorded in
another table.
My code is below and I do not know how to modify it to accomplish the
above need.
Thank you!
--------------------
Public Function CreateAttendanceRecords()
On Error GoTo Err_CreateAttendanceRecords_Click
Dim i, j, k As Variant
Dim dbs As Database
Dim rst As Recordset
Dim strSql As String
strSql = "SELECT RecordID, ResidentID, Date, ConfType FROM
TblAttendance;"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSql)
For Each i In Forms!frmAttendance!lstResidents.ItemsSelected
rst.AddNew
rst!ResidentID = Forms!frmAttendance!lstResidents.ItemData(i)
rst!Date = Forms!frmAttendance!Date
For Each j In Forms!frmAttendance!
lstConferenceTypes.ItemsSelected
rst!ConfType = Forms!frmAttendance!
lstConferenceTypes.ItemData(j)
Next j
rst.Update
Set rst = Nothing
MsgBox "Records Created"
Exit_CreateAttendanceRecords_Click:
Exit Function
Err_CreateAttendanceRecords_Click:
Select Case Err.Number
Case 3022 'ignore duplicate keys
Resume Next
Case Else
MsgBox Err.Number & "-" & Err.Description
Resume Exit_CreateAttendanceRecords_Click
End Select
End Function