M
max
I have a table called subject_teacher_details with fields:
initials,subject_taught and class. I would like to use
Dlookup in a function called from a textbox on a report to
display the corresponding "initials" of the particular
subject's teacher for a particular class. I have done the
following but keep getting "#error" on the report.
please help.
Function findInitials( students_class, subject ) As String
' students_class passed as reference to a field on
report's record source
' subject passed as string ,ie "english"
Dim init As Variant 'holds the subject teachers
initials to be returned
'by this function
init = DLookup(" [subject_teacher_details]!
[initials]", "subject_teacher_details", _
" [subject_teacher_details]![class] =&'students_class'&
And [subject_teacher_details]![subject_taught]
=& 'subject'&")
If IsNull(init) = True Then
findInitial = CStr(" ") 'if dlookup returns null,
show blank space on report
Else
findInitial = CStr(init)
End If
End Function
initials,subject_taught and class. I would like to use
Dlookup in a function called from a textbox on a report to
display the corresponding "initials" of the particular
subject's teacher for a particular class. I have done the
following but keep getting "#error" on the report.
please help.
Function findInitials( students_class, subject ) As String
' students_class passed as reference to a field on
report's record source
' subject passed as string ,ie "english"
Dim init As Variant 'holds the subject teachers
initials to be returned
'by this function
init = DLookup(" [subject_teacher_details]!
[initials]", "subject_teacher_details", _
" [subject_teacher_details]![class] =&'students_class'&
And [subject_teacher_details]![subject_taught]
=& 'subject'&")
If IsNull(init) = True Then
findInitial = CStr(" ") 'if dlookup returns null,
show blank space on report
Else
findInitial = CStr(init)
End If
End Function