S
Song
Private Sub Sect_BeforeUpdate(Cancel As Integer)
Dim db As dao.Database
Dim rst As dao.Recordset
Set rst = CurrentDb.OpenRecordset("Select * From qryData Where
[sect] = '" & Me.Sect _
& "' And [TimeIn] >= #" & [Forms]![MainMenu].[From] & _
"# And [TimeOut] <= #" & [Forms]![MainMenu].[To] + 1 & "#")
If rst.EOF Then
MsgBox Me.Sect & " is not valid section #, or" & vbCrLf _
& "no student signed in " & Me.Sect & " during the period
specified.", , conAppName
Cancel = True
Else
Me.Course = rst![Course]
End If
Set db = Nothing
Set rst = Nothing
Exit_sect_BeforeUpdate:
Exit Sub
Err_sect_BeforeUpdate:
MsgBox Err.Description
Resume Exit_sect_BeforeUpdate
End Sub
Above code generate error message. Help is needed. Thanks.
Dim db As dao.Database
Dim rst As dao.Recordset
Set rst = CurrentDb.OpenRecordset("Select * From qryData Where
[sect] = '" & Me.Sect _
& "' And [TimeIn] >= #" & [Forms]![MainMenu].[From] & _
"# And [TimeOut] <= #" & [Forms]![MainMenu].[To] + 1 & "#")
If rst.EOF Then
MsgBox Me.Sect & " is not valid section #, or" & vbCrLf _
& "no student signed in " & Me.Sect & " during the period
specified.", , conAppName
Cancel = True
Else
Me.Course = rst![Course]
End If
Set db = Nothing
Set rst = Nothing
Exit_sect_BeforeUpdate:
Exit Sub
Err_sect_BeforeUpdate:
MsgBox Err.Description
Resume Exit_sect_BeforeUpdate
End Sub
Above code generate error message. Help is needed. Thanks.