report date range

  • Thread starter klp via AccessMonster.com
  • Start date
K

klp via AccessMonster.com

I have a report that will display data from an inventory transaction history
form. There I would enter in the date and several other criteria. After doing
so I filter the form to my selection and then print my report. I wanted the
date range that is on the form to print on the report. I hvae done this in
several other reports and never had a problem until now. I'm getting #NAME.
The form is still open upon viewing the report. On the report I have a text
box with the logic of:

="Report Date Between: " & [Forms]![frmInvTransactionHistory]![BegtDate] & "
and " & [Forms]![frmInvTransactionHistory]![EndDate]

Any ideas? Thanks in advance.
Kim P
 
K

klp via AccessMonster.com

Yes is should be BegDate sorry. typo.
You have [BegtDate] - should this be [BegDate] ?
I have a report that will display data from an inventory transaction history
form. There I would enter in the date and several other criteria. After doing
[quoted text clipped - 9 lines]
Any ideas? Thanks in advance.
Kim P
 
K

KenSheridan via AccessMonster.com

Without the typo, that should work in this case. But another way of doing it
is to pass the value to the report via the OpenArgs mechanism. This has the
advantage that the calling form need not remain open, which while not
necessary in your case, might be preferred in other situations. So ignoring
the additional criteria for the sake of this example, the code to open the
report from the form might be along these lines:

Const REPORTNAME = "YourReportName"
Dim strCriteria As String
Dim strArgs As String

strCriteria = "TransactionDate Between #" & _
Format(Me.BegDate,"yyyy-mm-dd") & "# And #" & _
Format(Me.EndDate,"yyyy-mm-dd") & "#"

strArgs = ""Report Date Between: " & Me.BegtDate & _
" and " & Me.EndDate

DoCmd.OpenReport REPORTNAME, _
View:=acViewPreview, _
WhereCondition:=strCriteria, _
OpenArgs:=strArgs

Add a text box to the report with a ControlSource of:

=[OpenArgs]

Note the use of the ISO standard of YYYY-MM-DD for date notation when
defining the date range for the OpenReport method's WhereCondition argument.
This ensures that the dates entered as the parameters are correctly
interpreted regardless of the system regional date format in use.

While on the subject of the OpenArgs mechanism you might find the demo file
at the following link of interest. It shows how multiple arguments can be
passed, either as a literal value list, or as named arguments:

http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=24091&webtag=ws-msdevapps


Ken Sheridan
Stafford, England
I have a report that will display data from an inventory transaction history
form. There I would enter in the date and several other criteria. After doing
so I filter the form to my selection and then print my report. I wanted the
date range that is on the form to print on the report. I hvae done this in
several other reports and never had a problem until now. I'm getting #NAME.
The form is still open upon viewing the report. On the report I have a text
box with the logic of:

="Report Date Between: " & [Forms]![frmInvTransactionHistory]![BegtDate] & "
and " & [Forms]![frmInvTransactionHistory]![EndDate]

Any ideas? Thanks in advance.
Kim P
 

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