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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with outputing data in report

Status
Not open for further replies.

ahau

Programmer
Apr 19, 2006
51
AU
Hi,

I was wondering if anyone might be able to help me here.

In a report, is there any way i can set a size for a textbox?

for example, there is a field in a table that has value of
SEPP (Air Quality)
EPA licences
EPA buffer zone document, AQ286

However, in the report, the textbox called TB_References that i assigned the value to only shows one line i.e SEPP (Air Quality). I have made sure that the can grow = "yes". It only shows the three lines there if i extend the height of the textbox.

I don't understand why the can-grow feature doesn't work. I don't know if the program i wrote causes it. I have checked it however, by using the msgbox to output me.TB_References. It actually shows the full value i.e. three lines of words there.

here is the code
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim response, key As String
Dim rsNew As New ADODB.Recordset

rsNew.Open "Select * from [Framework Outline]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

If Me.Structure <> "P" Then
Do Until rsNew.EOF
If rsNew!FO_ID = Me.Structure Then
Me.TB_References = rsNew!References
Exit Do
End If

rsNew.MoveNext
Loop
ElseIf Me.Structure = "P" Then
Me.TB_References = Me.References
End If

rsNew.Close

End Sub

what this code does is it checks if the structure is "P". If it's P, it'd immediately print the data to the report. Or else, it'd go look up the same table for the FO_ID that has the same value as the structure. It takes the value of the wanted field i.e. References and assign it to the TB_References.

At first, i thought it'd be quite easy but i was wrong. I already spent a lot of time on this but couldn't exactly solve this as to why the TB_Reference doesn't show the entire value given that the "can grow" is set to yes.

Your help is greatly appreciated. Thank you in advance
 
I have tested a small report with your code, and the boxes seem to grow properly when the code is put in the On Format event, rather than the On Print event. I think the On Print event occurs after all formatting, so the box size has already been set.
 
Thank you Remou for your help.

I quote,
The boxes seem to grow properly when the code is put in the On Format event, rather than the On Print event. I think the On Print event occurs after all formatting, so the box size has already been set.

I see so i can't use the On Print event. I'd try to find out the difference between the On Print and On Format.

Thank you once again for your effort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top