="Report Date Between: " & [Forms]![frmInvTransactionHistory]![BegtDate] & "
and " & [Forms]![frmInvTransactionHistory]![EndDate]
Any ideas? Thanks in advance.
Kim P
--
Message posted via http://www.accessmonster.com
"klp via AccessMonster.com" wrote:
> .
>
RonaldoOneNil wrote:
>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]
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:
Ken Sheridan
Stafford, England