calling a function from detail line of a report

  • Thread starter Thread starter Andrea
  • Start date Start date
A

Andrea

In the module of a report, I wrote a function that
combines string fields and displays the results within the
detail line of the report. The functions work properly.

The problem that I have is at the initial runtime of the
report. After the database is started up, the very first
time the report is run, the user is prompted for the value
of the text box that calls the function. If I just click
OK and let the report finish running and then close the
report and rerun it, it runs fine and perfectly executes
the function. Why is this? Am I putting something the
the wrong place?

Please help!! Thanks for the advice in advance!

Andrea
 
In a text box that's in the detail section of the report I
call the function by setting the value=
[build_parents_names]

Here it is...

Function build_parents_names() As String

' Builds the parents_names field from data
Dim strName As String
Dim strLen As Long
strName = ""
If Not IsNull(mother_name) Then strName =
RTrim$([mother_name]) & " & "
If Not IsNull(father_name) Then
strName = strName & RTrim$([father_name])
Else
strLen = Len(strName)
If strLen <> 0 Then
strName = Mid$(strName, 1, strLen - 3)
End If
End If
build_parents_names = strName

End Function

Thanks!
 
Back
Top