L
Laurel
The following function has an error in it. There is no column called
"Comment" in the table "tblScores." But in my XP 2003 Pro/Access 2003
environment, control is never transferred to the error handler. Instead,
the function just returns an empty string. In a Windows 2000 environment,
control does go to the error handler, but the error is "<database name>
can't find the field Forms referred to in your expression." Not very
helpful. But the 2000 environment at least is recognizing that an error
occurred.
The database is created in the 2003 environment, using 2000 as the default
file format. The version is 2003 (11.6566.8132) SP 2. Is this a bug that
has been fixed? If so, how does one get fixes? I find the MS site
terminally confusing.
Public Function fncGetOverrideComment(ai_StudentID As Integer, _
adt_date As Date) As String
Dim ls_temp As String, ls_where As String
On Error GoTo Err_GetOverrideComment
ls_where = "Student_id = " & ai_StudentID & " AND Score_Date = #" _
& adt_date & "# And Period_Code = '" & gs_OverridePeriod & "'"
ls_temp = Nz(DLookup("Comment", "tblScores", ls_where))
Dim LV_DEBUG As Variant
LV_DEBUG = DLookup("COMMENT", "TBLSCORES", ls_where)
ls_temp = Nz(LV_DEBUG)
fncGetOverrideComment = ls_temp
Exit_GetOverrideComment:
Exit Function
Err_GetOverrideComment:
MsgBox (Err.Description)
fncGetOverrideComment = Failure
Resume Exit_GetOverrideComment
End Function
"Comment" in the table "tblScores." But in my XP 2003 Pro/Access 2003
environment, control is never transferred to the error handler. Instead,
the function just returns an empty string. In a Windows 2000 environment,
control does go to the error handler, but the error is "<database name>
can't find the field Forms referred to in your expression." Not very
helpful. But the 2000 environment at least is recognizing that an error
occurred.
The database is created in the 2003 environment, using 2000 as the default
file format. The version is 2003 (11.6566.8132) SP 2. Is this a bug that
has been fixed? If so, how does one get fixes? I find the MS site
terminally confusing.
Public Function fncGetOverrideComment(ai_StudentID As Integer, _
adt_date As Date) As String
Dim ls_temp As String, ls_where As String
On Error GoTo Err_GetOverrideComment
ls_where = "Student_id = " & ai_StudentID & " AND Score_Date = #" _
& adt_date & "# And Period_Code = '" & gs_OverridePeriod & "'"
ls_temp = Nz(DLookup("Comment", "tblScores", ls_where))
Dim LV_DEBUG As Variant
LV_DEBUG = DLookup("COMMENT", "TBLSCORES", ls_where)
ls_temp = Nz(LV_DEBUG)
fncGetOverrideComment = ls_temp
Exit_GetOverrideComment:
Exit Function
Err_GetOverrideComment:
MsgBox (Err.Description)
fncGetOverrideComment = Failure
Resume Exit_GetOverrideComment
End Function