R
RipperT
Access 2000. I have a simple form with two unbound text boxes for the user
to enter a date range and a button to open a report resticted by the dates.
I would like the two dates passed on to the report to show in labels when it
opens. I thought a good way to do this would be to create an array with the
two date values and pass the array in the openargs argument. (This may not
be the best way, but this is my first venture into arrays). Access help says
I can refer to the array as a whole (but doesn't explain how) when I want to
refer to all the values it holds, or I can refer to its individual elements.
Since there is only one openargs argument and it has to be a string, is
there a way to pass the single array variable to the report's open event and
then extract the two dates for use in the report? I've created the array
simply enough, but Access won't let me pass it using openargs.
Dim stDocName As String
Dim varDate(1) As Variant
varDate(0) = Forms!frmMain.txtStartDate
varDate(1) = Forms!frmMain.txtEndDate
stDocName = "rptMonthlyStats"
DoCmd.OpenReport stDocName, acViewPreview, , , , varDate
This generates the error: An expression you entered is the wrong data type
for one of the arguments
Access help says that if I declare the array as type variant, I can place a
whole array in a variant resulting in a single variant variable containing
the whole array. Can I not then pass this single variant in the openargs
argument?
Many thanks,
Rip
to enter a date range and a button to open a report resticted by the dates.
I would like the two dates passed on to the report to show in labels when it
opens. I thought a good way to do this would be to create an array with the
two date values and pass the array in the openargs argument. (This may not
be the best way, but this is my first venture into arrays). Access help says
I can refer to the array as a whole (but doesn't explain how) when I want to
refer to all the values it holds, or I can refer to its individual elements.
Since there is only one openargs argument and it has to be a string, is
there a way to pass the single array variable to the report's open event and
then extract the two dates for use in the report? I've created the array
simply enough, but Access won't let me pass it using openargs.
Dim stDocName As String
Dim varDate(1) As Variant
varDate(0) = Forms!frmMain.txtStartDate
varDate(1) = Forms!frmMain.txtEndDate
stDocName = "rptMonthlyStats"
DoCmd.OpenReport stDocName, acViewPreview, , , , varDate
This generates the error: An expression you entered is the wrong data type
for one of the arguments
Access help says that if I declare the array as type variant, I can place a
whole array in a variant resulting in a single variant variable containing
the whole array. Can I not then pass this single variant in the openargs
argument?
Many thanks,
Rip