Export to Snapshot with parameters

M

Mishanya

I have report wich runs 1) filtered by the ClientID value from the form it
runs from (by strWhere criteria in its VBA code) and 2) filtered by
date-range from the same form (the Date field of the report' query has the
parameters wich "catch" StartDate and EndDate entered in the form).
I run the report by either of 2 buttons with acPreview and acNormal VBA
commands (for viewing and printing respectively) .

Now I've added button programmed with built-in Acces Macro OutputTo command
to export the report directly to Shapshot. But it does not take care of the 2
mentioned filters.

How can I fix the Macro or maybe put VBA code instead to export the report
directly to Snapshot without previewing having both conditions executed?
 
D

Dale Fye

instead of using the WHERE clause of the OpenReport method to filter the
reports recordset, you need to actually imbed these values in the reports
underlying query.
So, instead of a query that looks like:

SELECT * FROM myTable

you would do something like:

SELECT * FROM myTable
WHERE [DateField] >= [Forms]!formName.txtStartDate
AND [DateField] <= [Forms]!formName.txtEndDate

You may need to declare these form fields as parameters (dates). If you
don't know how to do this, post back and I'll provide some instructions.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
M

Mishanya

hi dale
I've already had your method for the date values, but the ClientID indeed
was passed thru WHERE clause, wich worked for previewing and printing to MS
Document Imaging, but not for exporting (why?).
Now I've implemented this for the ClientID as well - and this made the trick.
Thanks a lot!


Dale Fye said:
instead of using the WHERE clause of the OpenReport method to filter the
reports recordset, you need to actually imbed these values in the reports
underlying query.
So, instead of a query that looks like:

SELECT * FROM myTable

you would do something like:

SELECT * FROM myTable
WHERE [DateField] >= [Forms]!formName.txtStartDate
AND [DateField] <= [Forms]!formName.txtEndDate

You may need to declare these form fields as parameters (dates). If you
don't know how to do this, post back and I'll provide some instructions.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Mishanya said:
I have report wich runs 1) filtered by the ClientID value from the form it
runs from (by strWhere criteria in its VBA code) and 2) filtered by
date-range from the same form (the Date field of the report' query has the
parameters wich "catch" StartDate and EndDate entered in the form).
I run the report by either of 2 buttons with acPreview and acNormal VBA
commands (for viewing and printing respectively) .

Now I've added button programmed with built-in Acces Macro OutputTo command
to export the report directly to Shapshot. But it does not take care of the 2
mentioned filters.

How can I fix the Macro or maybe put VBA code instead to export the report
directly to Snapshot without previewing having both conditions executed?
 
D

Dale Fye

Well, maybe because the OutputTo method does not support a Filter or Where
clause, like the OpenReport method does.

Who knows why Microsoft does what they do. But this is definately a
capability I would have put in the OutputTo method.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Mishanya said:
hi dale
I've already had your method for the date values, but the ClientID indeed
was passed thru WHERE clause, wich worked for previewing and printing to MS
Document Imaging, but not for exporting (why?).
Now I've implemented this for the ClientID as well - and this made the trick.
Thanks a lot!


Dale Fye said:
instead of using the WHERE clause of the OpenReport method to filter the
reports recordset, you need to actually imbed these values in the reports
underlying query.
So, instead of a query that looks like:

SELECT * FROM myTable

you would do something like:

SELECT * FROM myTable
WHERE [DateField] >= [Forms]!formName.txtStartDate
AND [DateField] <= [Forms]!formName.txtEndDate

You may need to declare these form fields as parameters (dates). If you
don't know how to do this, post back and I'll provide some instructions.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Mishanya said:
I have report wich runs 1) filtered by the ClientID value from the form it
runs from (by strWhere criteria in its VBA code) and 2) filtered by
date-range from the same form (the Date field of the report' query has the
parameters wich "catch" StartDate and EndDate entered in the form).
I run the report by either of 2 buttons with acPreview and acNormal VBA
commands (for viewing and printing respectively) .

Now I've added button programmed with built-in Acces Macro OutputTo command
to export the report directly to Shapshot. But it does not take care of the 2
mentioned filters.

How can I fix the Macro or maybe put VBA code instead to export the report
directly to Snapshot without previewing having both conditions executed?
 
M

Mishanya

100%!

Dale Fye said:
Well, maybe because the OutputTo method does not support a Filter or Where
clause, like the OpenReport method does.

Who knows why Microsoft does what they do. But this is definately a
capability I would have put in the OutputTo method.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Mishanya said:
hi dale
I've already had your method for the date values, but the ClientID indeed
was passed thru WHERE clause, wich worked for previewing and printing to MS
Document Imaging, but not for exporting (why?).
Now I've implemented this for the ClientID as well - and this made the trick.
Thanks a lot!


Dale Fye said:
instead of using the WHERE clause of the OpenReport method to filter the
reports recordset, you need to actually imbed these values in the reports
underlying query.
So, instead of a query that looks like:

SELECT * FROM myTable

you would do something like:

SELECT * FROM myTable
WHERE [DateField] >= [Forms]!formName.txtStartDate
AND [DateField] <= [Forms]!formName.txtEndDate

You may need to declare these form fields as parameters (dates). If you
don't know how to do this, post back and I'll provide some instructions.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



:

I have report wich runs 1) filtered by the ClientID value from the form it
runs from (by strWhere criteria in its VBA code) and 2) filtered by
date-range from the same form (the Date field of the report' query has the
parameters wich "catch" StartDate and EndDate entered in the form).
I run the report by either of 2 buttons with acPreview and acNormal VBA
commands (for viewing and printing respectively) .

Now I've added button programmed with built-in Acces Macro OutputTo command
to export the report directly to Shapshot. But it does not take care of the 2
mentioned filters.

How can I fix the Macro or maybe put VBA code instead to export the report
directly to Snapshot without previewing having both conditions executed?
 

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