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

Adding a Date at Report Runtime 2

Status
Not open for further replies.

Garridon

Programmer
Mar 2, 2000
718
US
I have a report where I'd like to be able to add a suspense date when the report is run. The date doesn't need to be stored in a field in the database.

Can this be done?

Thanks!

Linda Adams (Garridon@aol.com)
"The Importance of Being Grammarian," published in The Toastmaster, March 2001
 
Hi Linda,
You might try this and see if it's what you're after:

Add a text box to your Page Header (by example).
Name it TxtDate.

Now in the Page Header section "format" event (in VB) add this:

Me.TxtDate = InputBox("What's the date Linda?", "We'll put this on the report!", Date)

Give that a shot! :) Gord
ghubbell@total.net
 
I tried it out and it works ... sort of. When I try to print the report, it asks for the date twice. This is the code behind the print button:


Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.OpenReport "rptCurrentRecord", acNormal, _
"", "[lngTaskID]=[Forms]![frmTask]![lngTaskID]"


cmdPrint_Click_Exit:
Exit Sub

cmdPrint_Click_Err:
MsgBox Err.Description
Resume cmdPrint_Click_Exit

End Sub

Could something in the code be causing the dual input boxes?
Thanks!
Linda Adams (Garridon@aol.com)
"The Importance of Being Grammarian," published in The Toastmaster, March 2001
 
Hi Linda!
Ooooh could this be a two page report? Who cares...I wooped it for you:

As before but add this:

intx = intx + 1
If intx > 1 Then Exit Sub
Me.TxtDate = InputBox("What's the date Linda?", "We'll put this on the report!", Date)

Now just below the "Option Compare Database" or "Option Explicit" line (if it's there) add:

Dim intx As Integer

(Module level variable that'll hold its value till the report is closed.)

Should work like a gem. :) Gord
ghubbell@total.net
 
Add a text box in Report Header or where you want the date and =[Input Date]
When yo run it it will ask for the parameter as it is a non existing field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top