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

Dynamic Report Caption change

Status
Not open for further replies.

GShen

MIS
Sep 26, 2002
561
US
Hi,
Is there a way of changing the report caption dynamically ?
I have a main report driven by nothing (Eg. no stored procedure or table). It has 6 or 7 subreports. On the Report Header of the main report, I put in me.Captions = 'xxxxxxx'. It works perfectly when you open the report in Access with acPreview. But when you open it with acNormal, it does nothing (eg. it reverts back to the report name). I also tried to just go into the property on the report under Captions. You can change it there to a hard value but I could not put something in like Forms!formname!fieldIwanttodisplay. It prints everything I put in there as a literal. I tried surrounding quotes, double quotes, no quotes, = followed by value. Nothing seemed to work. Not sure you can do it there or not. Of course if you leave it blank, then it grabs the report name and substitutes it in there. Well I then tried to change the report name but No can do within the reports header section, not updatable, read only.

Has anyone ever done this before. I found tons of things on the web only to find people having the same problem I am having, so I am not going crazy.

Thanks in advance.

Remember when... everything worked and there was a reason for it?
 
Typed too fast. I meant me.Caption.
-------------------------------------------
Private Sub Report_Open(Cancel As Integer)
Me.Caption = Forms!frmMainMenu!txtAdCustomer
End Sub
--------------------------------------------

I also stand corrected, I do this on the open event for the main repport, not in the report header as I stated, sorry.

Like I said, it works in acPreview, but not acNormal

Eg. DoCmd.OpenReport stDocName, acPreview ' works

Eg. DoCmd.OpenReport stDocName, acNormal 'Does nothing

The reason I am trying to do this to so the operator can have a sense as to where he is when he clicks on these reports. There is a recordset of customers to print. It takes about 1/2 hour or more to queue this stuff all up. There are a 10 reports or so for each customer. This happens to be the one that takes the longest time, so I figured if I could show him what customer it was up to, he would have an idea where he was. The pc pretty much locks up when you start this process. Alternately, I was going to display a message within the loop but I could not figure out how to use the message box without having him manually ack. it each time. Is there a way of doing that ?
THanks Duane






Remember when... everything worked and there was a reason for it?
 
I have seen this issue before and thought I had a work around. The only solution I can think of is to first open the report in design view, set the caption, and then print.

Duane
Hook'D on Access
MS Access MVP
 
Duane,
I was thinking the same thing but there is enough stuff going on in this code now, I really did not want to start playing around with that. This thing queues up over 400 reports. I send them to a copier, they are sequenced, etc., etc. If it craps out, it is a nightmare trying to restart.

Is there anything I can do with msgbox or anything else to flash a message as to where it is in the recordset loop? That is what I am trying to accomplish ? I saw some stuff on the web but the key here is simple. I do not want to start creating macros, etc. because of my above reason.

Thanks for all your help. At least I know I am not crazy.

Gary

Remember when... everything worked and there was a reason for it?
 
Okay, thanks. Never played with the status bar. Do I change this is vb ? Do you have any sample code ? I have the data in the record set. If I could set something, somehow to my customer number and flash it somewhere that would be perfect.

Thanks.....

Remember when... everything worked and there was a reason for it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top