A
Al Hotmail
Print a report with a field value that is dependent on value of another
field
I have a report that is based on a query
The output is grouped into 23 different events
Under each event the record name field is printed
To the right of the name I need to print the value of a field which is
dependent on the event value
Some of the fields are date, strings, and integer
I am having trouble getting a module using Select Case function to work
Some events require 4 lines of information to be printed from 4 different
fields.
Function PrintOutput (EventNo As Long) As String
Dim FieldName1 as Date
Dim FieldName2 as Date
Dim FieldName3 as Date
Dim FieldName4 As String
Dim Field_Name5 As String
Dim Field_Name6 As integer
Dim FieldName7 As integer
' continued to field name 23
Select Case EventNo
Case Is = 1
PrintOutput = FieldName5
Case Is = 2
PrintOutput = Format(FieldName2, "mmm. d, yyyy")
Case Is = 3
PrintOutput = FieldName4 & vbCrLf &_
FieldName5 & vbCrLf &_
FieldName7 & vbCrLf &_
FieldName20
Case Is = 4
PrintOutput = Format(FieldName2, "mmm. d, yyyy")
Case Is = 5
PrintOutput = FieldName4
Case Is = 14
PrintOutput = If Field6 = -1 Then Field9
Else
"??UNKNOWN??"
End If
End Function
Any help will be greatly appreciated
Thanks in advance
Al
field
I have a report that is based on a query
The output is grouped into 23 different events
Under each event the record name field is printed
To the right of the name I need to print the value of a field which is
dependent on the event value
Some of the fields are date, strings, and integer
I am having trouble getting a module using Select Case function to work
Some events require 4 lines of information to be printed from 4 different
fields.
Function PrintOutput (EventNo As Long) As String
Dim FieldName1 as Date
Dim FieldName2 as Date
Dim FieldName3 as Date
Dim FieldName4 As String
Dim Field_Name5 As String
Dim Field_Name6 As integer
Dim FieldName7 As integer
' continued to field name 23
Select Case EventNo
Case Is = 1
PrintOutput = FieldName5
Case Is = 2
PrintOutput = Format(FieldName2, "mmm. d, yyyy")
Case Is = 3
PrintOutput = FieldName4 & vbCrLf &_
FieldName5 & vbCrLf &_
FieldName7 & vbCrLf &_
FieldName20
Case Is = 4
PrintOutput = Format(FieldName2, "mmm. d, yyyy")
Case Is = 5
PrintOutput = FieldName4
Case Is = 14
PrintOutput = If Field6 = -1 Then Field9
Else
"??UNKNOWN??"
End If
End Function
Any help will be greatly appreciated
Thanks in advance
Al