S
Song
In A2003, the code works. After I converted to A2007, following code give me
'type mismatch' error. It points to Set rst= line. I double check those
fields still text and same code still run in A2003.
Private Sub Sect_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Select * From Course Where [sem] = '"
& Me.Sem & "' And [sect] = '" & Me.Sect & "'")
If rst.EOF Then
MsgBox Me.Sect & " Is not a valid Section", , conAppName
Cancel = True
Else
Me.Subj = rst![Subj]
Me.No = rst![No]
Me.Lt = rst![Lt]
End If
Set rst = Nothing
Exit_sect_BeforeUpdate:
Exit Sub
Err_sect_BeforeUpdate:
MsgBox Err.Description
Resume Exit_sect_BeforeUpdate
End Sub
'type mismatch' error. It points to Set rst= line. I double check those
fields still text and same code still run in A2003.
Private Sub Sect_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Select * From Course Where [sem] = '"
& Me.Sem & "' And [sect] = '" & Me.Sect & "'")
If rst.EOF Then
MsgBox Me.Sect & " Is not a valid Section", , conAppName
Cancel = True
Else
Me.Subj = rst![Subj]
Me.No = rst![No]
Me.Lt = rst![Lt]
End If
Set rst = Nothing
Exit_sect_BeforeUpdate:
Exit Sub
Err_sect_BeforeUpdate:
MsgBox Err.Description
Resume Exit_sect_BeforeUpdate
End Sub