Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UnBound Control Problem in a Report

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
I have a report that needs to print a detail line from an unbound control in the detail line. I read a databae to populate this unbound control. However, the problems that I'm having is that the vba code works correct meaning that it retrieves the information but the report (unbound control) does not show the information when the report print.

Can someone give me guidance to enable me to print the detail line instead of not printing anything.

Thank you for guidance.

Luis

CODE:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call F35detailPoc(unboundF35Line)
Me.POC = unboundF35Line
End Sub

Function F35detailPoc(unboundF35Line)
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim strRead As String

strRead = "SELECT [tblAwardFeeF-35contact].[F-35Contact] " _
& "FROM [tblAwardFeeF-35contact]" _
& "WHERE ((([tblAwardFeeF-35contact].Period)=" & Me.Period & ")" & " AND (([tblAwardFeeF-35contact].Phase)=" & "'" & Me.Phase & "')" & " AND (([tblAwardFeeF-35contact].EvaluationArea)=" & "'" & Me.EvaluationArea & "')" & " AND (([tblAwardFeeF-35contact].[Item No])=" & Me.Item_No & "))"

Set dbs = CurrentDb()
Set rs = CurrentDb.OpenRecordset(strRead)
With rs
Do Until rs.EOF
Debug.Print "rs field = " & rs![F-35Contact] & unboundF35Line
unboundF35Line = unboundF35Line + rs![F-35Contact] & vbNewLine
.MoveNext
Loop
'Debug.Print "emailstring - 1= " & emailstrng
End With

Set rs = Nothing
End Function

 
The unboundF35Line is a parameter that I'm passing to the function to put together the string that I will be concatenated in the unboundF35Line field. This field needs to be put on the report unbound control.

Change the Detail line as follows;

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim unboundF35Line As String
unboundF35Line = " " 'Initialize variable
Call F35detailPoc(unboundF35Line)
Reports!preAnalysis!F35POC = unboundF35Line
End Sub

Then change the Can Shrink and Can Grow properties to "No" and "Yes". Re-execute the report and it works.

However, I have to define the Unbound control to the maximum size to accomodate at least 7 elements.

Thank you for your feedback. Your feedback led me to additional testing thus solving this problem.

Really appreciate your guidance.

Luis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top