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!

How to create different headers or Text

Status
Not open for further replies.

Rainer2000

IS-IT--Management
Apr 27, 2003
61
0
0
DE
I have several reports that differ only in the header. Is there any way to populate the report through a VB routine , thus making it one report?

Something Like:

Private Sub Befehl22_Click()
On Error GoTo Err_Befehl122_Click
Me.Recalc

Dim stDocName As String
'Dim Header As String
'Header = "Header for Transatlantic"
stDocName = "Openorders"

DoCmd.OpenReport stDocName, acPreview, , "[Ausblenden]=False AND [Shipped] ='Nein' AND [Bestellnummer-D]Not Like 0 AND [Anfragende Firma] Like'Transatlantic*'"

Exit_Befehl122_Click:
Exit Sub

Err_Befehl122_Click:
MsgBox Err.Description
Resume Exit_Befehl122_Click
End Sub


Rainer
 
I applaud your effort to use a single report rather than many.

"header" in a report refers to any of the sections like Report Header, Page Header, or Group Header.

"populate the report" is confusing. You can set the record source of a report or subreport. You can also set the values of unbound controls (text boxes).

It isn't clear to me what you would like to accomplish.

Duane
Hook'D on Access
MS Access MVP
 
Thank you for helping me.

I want to give each of the reports a different text header.( One header could be "General Motors", the 2nd Report Header text could be "Ford Motors" ) I am presently using a text-field which I am filling each time when entering new data.
This works, but there must be a more clever solution.

Rainer
 
I suggested there were three types of "headers" which are report sections. Apparently you have a single text box or label control near the top of your report that you want to change either the control source or the caption.

Can you clarify which it is and where the values would come from?

If this is a text box, you can have the user select the values from a combo box on a form and then simply reference the form control in the text box's control source:
Code:
Control Source: =Forms!frmYourForm!cboReportHeader

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top