Page Header Error

scouser

Registered User.
Local time
Today, 19:32
Joined
Nov 25, 2003
Messages
767
Hi guys. I have the following in my Page Header:

Code:
=Forms!frmOrderAnalysisServiceSpecific!FromDate & " to " & Forms!frmOrderAnalysisServiceSpecific!ToDate

This works fine on the first page. However page two displays an error:
Code:
#name

Am I missing something obvious?

I can move the code to the Report Header, but it would be nice to display on every page.

Help appreciated as always.
Regards,
Phil.
 
Try this code in report page header....

Make two unbound text boxes....Control Source for each....

=Form![frmOrderAnalysisServiceSpecific]![From Date - 00/00/00]
=Form![frmOrderAnalysisServiceSpecific]![To Date - 00/00/00]

hth,
Michael
 
Nope?

Michael thanks for your reply. Unfortuantly your code produced an error. I have attached a jpeg of how pages one and two of the report are displayed. As you can see, the Page Header displays without error on Page 1 of the Report. However the Page Header on Page two displays an error?

I have no idea why it is doing this?

Help appreciated as always!
Cheers,
Phil.
 

Attachments

  • Page Header Error.JPG
    Page Header Error.JPG
    27.5 KB · Views: 128
Cheers

Thanks for that Michael. It works...................
However....I need to find a fix for my way as the user calls a form from the main menu. The data entered here dpicts what the report displays. I have implemented the calendar function, si I would prefer the user specifies the dates via the from and not when the report is called.
If I get it working I will post a sample.
One again thanks for your efforts.
Phil.
 
Is this an Access Quirk or ME?

I can not see for the life of me WHY Access will not display the following on EACH page header when the report has more than one page:

=Forms!frmLookUpInvoiceStatementDate!FromDate & " to " & Forms!frmLookUpInvoiceStatementDate!ToDate

Page One: For Period: 01/01/05 to 31/01/05
Page Two:#Name

Why oh why?
:confused:
Phil.
 
Form Open

Hi once again Rich. No the form closes once the user hits OK. Code on the on click event of the form:

Code:
On Error GoTo Err_RunReport

DoCmd.OpenReport "rprtOrderAnalysisByServiceType", acViewPreview
DoCmd.Close acForm, "frmOrderAnalysisByServiceType"
 
Exit_RunReport:
Exit Sub

Err_RunReport:
Select Case Err.Number
Case 2501 'There were no records, so close this report, run the next!
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description, , "ERROR " & Err.Source
End Select
Resume Exit_RunReport

I trust you know why!!
Cheers,
Phil.
 
You would be right!

Rich if I leave the form open the it works (as I am sure you knew it would). However the dam form sits slam in the middle of the report!!

Any ideas on a fix?
Cheers,
Phil.
 
Cheers Rich

Thanks Rich. I have done the following:

On the On-Click event of the cmd that calls the report I have added:
Code:
Me.Form.Visible = False

Then on th On_Close event of the report I have added:
Code:
DoCmd.Close acForm, "frmOrderAnalysisByServiceType", acSaveNo

That appears to do the trick. Would you say it was the best approach?
Cheers,
Phil.
 
Dam

That does not work when the report has no data!!
I get error:
2467: The expressin you entered refers to an object that is closed or doesn't exist.

Code:
Private Sub cmdOK_Click()
    On Error GoTo Err_RunReport

DoCmd.OpenReport "rprtOrderAnalysisByServiceType", acViewPreview
'DoCmd.Close acForm, "frmOrderAnalysisByServiceType", acSaveYes
Me.Form.Visible = False
 
Exit_RunReport:
Exit Sub

Err_RunReport:
Select Case Err.Number
Case 2501 'There were no records, so close this report, run the next!
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description, , "ERROR " & Err.Source
End Select
Resume Exit_RunReport
  
End Sub

Don't know what else to say!!
 
Scouser - I would run the check before you ever attempt to run the report...

kh
 
Humour Me

Hi Ken. Can you humour me and re-arrange the posted code as you would do it?
many Thanks,
Phil.
 
Just looking over the code, Would this work?

Code:
Private Sub cmdOK_Click()
    On Error GoTo Err_RunReport

DoCmd.OpenReport "rprtOrderAnalysisByServiceType", acViewPreview
'DoCmd.Close acForm, "frmOrderAnalysisByServiceType", acSaveYes
Me.Form.Visible = False
 
Exit_RunReport:
Exit Sub

Err_RunReport:
Select Case Err.Number
Case 2501 'There were no records, so close this report, run the next!
Resume [B]Exit_RunReport[/B]
Case Else
MsgBox Err.Number & ": " & Err.Description, , "ERROR " & Err.Source
End Select
Resume Exit_RunReport
  
End Sub
 
Got There

I am happy at last.........
Cheers Rich.
Phil.
 

Users who are viewing this thread

Back
Top Bottom