Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Transfer view to spreadsheet

Author  Topic 

TAS
Yak Posting Veteran

65 Posts

Posted - 2004-05-20 : 14:18:11
I use SQL Server with Access as front end (.adp).
I open report by using:

DoCmd.OpenReport "rptPaysToProvidersAgt", acViewPreview, WhereCondition:="vchrInsCode='" & Me.txtInsCode & "' And dtmPaid='" & Me.txtDate & "'"
The report "rptPaysToProvidersAgt" bounds to a view. Then, I try to transfer that report's result to a spreadsheet. I use
DoCmd.OutputTo acOutputServerView, "vwProvAgt", acFormatXLS, "F:\Users\Excel\ProvAgt.xls", True


But it returns me the the result without WhereCondition.Who can tell how to transfer a view with WhereCondition to a spreadsheet?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-05-20 : 18:51:35
Your OutputTo command doesn't make any reference to the report. All it does is grabs the view output and exports it (much the same as the TransferSpreadsheet command).

It's a relatively simple task to create a VBA procedure to export a view/query/table to a spreadsheet. You could do it in about 20 lines.
Go to Top of Page
   

- Advertisement -