Report Date

T

Todd

I have a form that has 2 fields on it, txtStartDate and
txtEndDate. From these two fields I pull a report,
rpt_DistrictEvents. I would like to add on the top
header to the title, the date ranges listed in
txtStartDate and txtEndDate. Is this possible?
 
J

jmonty

Add an unbound text box in your header. We'll call it
Text1...We will also call your form Form1 for example
purposes. With the report still in design mode, Click on
the menu View > Code and enter the following:

Private Sub Report_Open(Cancel As Integer)
Text1.setfocus
Text1.text = Forms!Form1!txtStartDate _
& " - " & _
Forms!Form1!txtEndDate
End Sub
 
G

Guest

Great
Thanks alot.
-----Original Message-----
Add an unbound text box in your header. We'll call it
Text1...We will also call your form Form1 for example
purposes. With the report still in design mode, Click on
the menu View > Code and enter the following:

Private Sub Report_Open(Cancel As Integer)
Text1.setfocus
Text1.text = Forms!Form1!txtStartDate _
& " - " & _
Forms!Form1!txtEndDate
End Sub


.
 
D

Duane Hookom

I can't imagine that this would work since you can't ever set the focus to a
REPORT control. This would work if this was a form but it wouldn't be
necessary to set the focus to the control. You could use:
Me.Text1 = Forms!Form1!txtStartDate _
& " - " & _
Forms!Form1!txtEndDate

Back to your report...
Create a text box with a control source of:
=Forms!Form1!txtStartDate & " - " & Forms!Form1!txtEndDate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top