Show 'From' and 'To' Dates on a Report

  • Thread starter Thread starter ryguy7272
  • Start date Start date
R

ryguy7272

I have a simple report. I am trying to get 'Invoice Dates' on my report,
which is dynamic and controlled by some VBA code (I can post the code if it’s
necessary). Anyway, in my ‘InvoiceDates’ TextBox I have this as the Control
Source:
=[Forms]![ReportForm]![cboFrom]

That’s causing an error, so that’s not right, but there must be an easy way
to do this…

The VBA is behind a Form called ‘ReportForm’. The code controls everything
on the report. Do I need to modify the code to pass the From and To dates as
variables to the Report?

Thanks in advance!
Ryan--
 
I'm guessing that the cboFrom may be a combo box and not a text box.

Sometimes you have to force Access to look inside the text or combo box.
Test these to:

=[Forms]![ReportForm]![cboFrom].text

=[Forms]![ReportForm]![cboFrom].value

Also remember that the form must stay open for this to work. It can be
minimized or even hidden, but must stay open.
 
On ReportForm you ought to have two unbound textboxes named FromDate and
ToDate. Your report should be based on a query which has an InvoiceDate
field. The criteria for the InvoiceDate field should be:
Between Forms!ReportForm!FromDate and Between Forms!ReportForm!ToDate

Assuming you want the invoicee dates in a title on your report, put a text
box named ReportTitle where you want the title. Put the following code in
the Open event of the report:
Me!ReportTitle.Caption = "Invoices Between " Forms!ReportForm!FromDate & "
And " & Forms!ReportForm!ToDate

Note that the ReportTitle form must be open when the report opens.

Steve
(e-mail address removed)
 
Nice, very nice! I ended up using this:
=[Forms]![ReportForm]![cboFrom].[Value] & " to " &
[Forms]![ReportForm]![cboTo].[Value]

Thanks Jerry!!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


Jerry Whittle said:
I'm guessing that the cboFrom may be a combo box and not a text box.

Sometimes you have to force Access to look inside the text or combo box.
Test these to:

=[Forms]![ReportForm]![cboFrom].text

=[Forms]![ReportForm]![cboFrom].value

Also remember that the form must stay open for this to work. It can be
minimized or even hidden, but must stay open.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


ryguy7272 said:
I have a simple report. I am trying to get 'Invoice Dates' on my report,
which is dynamic and controlled by some VBA code (I can post the code if it’s
necessary). Anyway, in my ‘InvoiceDates’ TextBox I have this as the Control
Source:
=[Forms]![ReportForm]![cboFrom]

That’s causing an error, so that’s not right, but there must be an easy way
to do this…

The VBA is behind a Form called ‘ReportForm’. The code controls everything
on the report. Do I need to modify the code to pass the From and To dates as
variables to the Report?

Thanks in advance!
Ryan--
 
I've don the same thing!

If you want to get fancy, you can also wrap each form reference with the
format function to better control how the dates look.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


ryguy7272 said:
Nice, very nice! I ended up using this:
=[Forms]![ReportForm]![cboFrom].[Value] & " to " &
[Forms]![ReportForm]![cboTo].[Value]

Thanks Jerry!!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


Jerry Whittle said:
I'm guessing that the cboFrom may be a combo box and not a text box.

Sometimes you have to force Access to look inside the text or combo box.
Test these to:

=[Forms]![ReportForm]![cboFrom].text

=[Forms]![ReportForm]![cboFrom].value

Also remember that the form must stay open for this to work. It can be
minimized or even hidden, but must stay open.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


ryguy7272 said:
I have a simple report. I am trying to get 'Invoice Dates' on my report,
which is dynamic and controlled by some VBA code (I can post the code if it’s
necessary). Anyway, in my ‘InvoiceDates’ TextBox I have this as the Control
Source:
=[Forms]![ReportForm]![cboFrom]

That’s causing an error, so that’s not right, but there must be an easy way
to do this…

The VBA is behind a Form called ‘ReportForm’. The code controls everything
on the report. Do I need to modify the code to pass the From and To dates as
variables to the Report?

Thanks in advance!
Ryan--
 
Steve,
I think that should be...
Between Forms!ReportForm!FromDate And Forms!ReportForm!ToDate
That second Between will cause a syntax error.

Also, I hope that isn't a real email address in your signature.
Spammers
regularly run robots to sweep up emails from newsgroup postings.
--
hth
Al Campagna



Steve said:
On ReportForm you ought to have two unbound textboxes named FromDate and
ToDate. Your report should be based on a query which has an InvoiceDate
field. The criteria for the InvoiceDate field should be:
Between Forms!ReportForm!FromDate and Between Forms!ReportForm!ToDate

Assuming you want the invoicee dates in a title on your report, put a text
box named ReportTitle where you want the title. Put the following code in
the Open event of the report:
Me!ReportTitle.Caption = "Invoices Between " Forms!ReportForm!FromDate & "
And " & Forms!ReportForm!ToDate

Note that the ReportTitle form must be open when the report opens.

Steve
(e-mail address removed)


ryguy7272 said:
I have a simple report. I am trying to get 'Invoice Dates' on my report,
which is dynamic and controlled by some VBA code (I can post the code if
it's
necessary). Anyway, in my 'InvoiceDates' TextBox I have this as the
Control
Source:
=[Forms]![ReportForm]![cboFrom]

That's causing an error, so that's not right, but there must be an easy
way
to do this.

The VBA is behind a Form called 'ReportForm'. The code controls
everything
on the report. Do I need to modify the code to pass the From and To
dates as
variables to the Report?

Thanks in advance!
Ryan--
 
Al,

You are right anout the second "Between". It slipped in when I copied and I
didn't catch it.

Steve


Al Campagna said:
Steve,
I think that should be...
Between Forms!ReportForm!FromDate And Forms!ReportForm!ToDate
That second Between will cause a syntax error.

Also, I hope that isn't a real email address in your signature.
Spammers
regularly run robots to sweep up emails from newsgroup postings.
--
hth
Al Campagna



Steve said:
On ReportForm you ought to have two unbound textboxes named FromDate and
ToDate. Your report should be based on a query which has an InvoiceDate
field. The criteria for the InvoiceDate field should be:
Between Forms!ReportForm!FromDate and Between Forms!ReportForm!ToDate

Assuming you want the invoicee dates in a title on your report, put a
text box named ReportTitle where you want the title. Put the following
code in the Open event of the report:
Me!ReportTitle.Caption = "Invoices Between " Forms!ReportForm!FromDate &
" And " & Forms!ReportForm!ToDate

Note that the ReportTitle form must be open when the report opens.

Steve
(e-mail address removed)


ryguy7272 said:
I have a simple report. I am trying to get 'Invoice Dates' on my report,
which is dynamic and controlled by some VBA code (I can post the code if
it's
necessary). Anyway, in my 'InvoiceDates' TextBox I have this as the
Control
Source:
=[Forms]![ReportForm]![cboFrom]

That's causing an error, so that's not right, but there must be an easy
way
to do this.

The VBA is behind a Form called 'ReportForm'. The code controls
everything
on the report. Do I need to modify the code to pass the From and To
dates as
variables to the Report?

Thanks in advance!
Ryan--
 
Back
Top