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

Strange things happen when you copy a report....

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
Hi all,

I copied a report today. 'Not the most unusual thing to do' I here you say. After copying it and deleting the page and report headers and footers, which didn't have anything in them, I found that one of the textboxes was throwing up an error! The textbox was identical to the original so how could this be?

I notice that if I put the fields as separate textboxes which were used in the textbox calculation on the report, then the textbox returned the correct result. If I left off one or more of the fields, then it produced the error!
I manage to get around it by putting the fields on the report and making then invisible, but it's strange why it should do this when the report was a copy and the original worked!

Just noticed that the were two labels in the report footer which were removed when I deleted the haders and footers. But these do not relate in any way to the calculated textbox -
Code:
now()
and
Code:
="Page " & [Page] & " of " & [Pages]

Here's the textbox calculation for all those interested.

=Trim([Report]![Name] & IIf(([Deptname] And [Report]![Name]),", ","") & [DeptName] & IIf((([Report]![Name] Or [deptname]) And [building]),", ","") & [Building])

I don't require help with this, but I thought it unusual enough to mention on here.

Ian Mayor (UK)
Program Error
Programmers do it one finger at a time!
 
Can you explain what the text box calculation does? Do you expect ([Deptname] And [Report]![Name]) to return a true or false?

Normally, the first argument of IIf() should be an expression that evaluates to either true or false.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top