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!

Format Report Caption

Status
Not open for further replies.

OOzy

Programmer
Jul 24, 2000
135
SA
I am trying to format the report caption to look like

20051109 - Action Items
YYYYMMDD - Action Items

using the code below but I am getting a compile error:can't find project or library.

Please help!

Code:
Private Sub Report_Open(Cancel As Integer)
Dim RC As Variant

RC = Format(Now(), "YYYYMMDD") + "-Action Items"

Report.Caption = RC
End Sub
 
There's a report forum (forum703), where report issues can probably be addressed more appropriately.

Here I'd probably try

[tt]Private Sub Report_Open(Cancel As Integer)
Dim strRC As string

strRC = Format(Date, "YYYYMMDD") & "-Action Items"

Me.Caption = strRC
End Sub[/tt]

Roy-Vidar
 
Roy,

I am still getting the same error. I have moved my question to the report forum.

Thx
 
Whilst Roy's code is better, I can get OOzy's code working as it is.

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
I think you have a references problem.
Go to tools->references and check the Available References. Does one say "MISSING:" in front of it? You need to unselect that one and try again.
Incidently, if you explicitly specify which library functions come from, you can work round it so:
Code:
RC = [b]VBA.[/b]Format([b]VBA.[/b]Now(), "YYYYMMDD") + "-Action Items"
but it's still best you try and sort the reference too.

hth

Ben.

----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Guys/Gals

oharab code worked fine.

BTW, I could not find Reference in Tools->Reference

Thank you.
 
It's in the code window & is the 1st option.
Incidently Michael Kaplan has done a lot of research into this and comes up with a way of fixing it every time.
It's a bit heavy going, but if you deploy your apps, it's something you need to read.

Ben

----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top