472,145 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Export Subform Result to Excel

Hi everyone!

I really need your help..

I have a search form..And in that search form I have a subform..When they search, the results will display in the subform..I want to export to excel the result in the subform based on the query they search..

Thank you in advance

Jan 23 '07 #1
9 10674
Yes its possible ..first i want to know the sub form which you have created is reflecting any query or by the table creating that sub - form any way u try the following code in that form...

1. in the desing view of the form ...creat a botton & in event tab in On Click Event write the following code

" On click_your button
Dim stdocname As String
stdocname = "your table or query name"
DoCmd.OutputTo acReport, stdocname
Jan 23 '07 #2
3,080 Expert 2GB
When you have a basic query for the subform and apply a filter, then that query's SQL can be combined with the filter to achieve what you need.

Need more info ?

Jan 23 '07 #3
Hi Thanx for all the replies..but appently I cant use do.cmd output to because the recordsource of my subform is query and asking for a parameter..

please explain to me further.. I really need all your help..

thank you in advance..
Jan 24 '07 #4
3,080 Expert 2GB
Hmm, then it's best to remove the parameter from the query and add a textbox on your mainform for the needed value and a button to activate the filtering of the subform by the value from the textbox.
That will also allow the creation of a query for the export to excel.

Idea ?

Jan 24 '07 #5
I already have combo boxes and text boxes..I used stored procedure to search multiple fields because im using .adp access..the recordset of my subform is the stored procedure I created for searching..
Jan 24 '07 #6
3,080 Expert 2GB
Hmm, I have no experience with .adp, but when you have a recordset behind the subform then you can use code and the RecordsetClone method to fill an excelsheet.
On the otherhand you could ofcourse also try to create a method for the stored procedure to redirect the found data to an excel sheet as DTS should have that possibility. Guess you'll need to ask a MS SQL expert how to do something like that.

Jan 24 '07 #7
3,080 Expert 2GB
Sorry, but I have no .adp experience yet.
Perhaps http://www.oreilly.com/catalog/accesscook2/ holds some good info.
When you follow the examples link you can download and check the sample databases for adp.

Jan 24 '07 #8
you should be able to export subform's content with use of Access add-in 'A2EE.mda' which is intended for exporting data from Access to Excel sheets.
You will download the add-in and see more details on:
Jun 9 '12 #9
5,501 Expert Mod 4TB
see if this helps

Search TransferSpreadsheet on this forum for info there.
You might start here:
Jun 11 '12 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by keali_lim | last post: by
4 posts views Thread by keali_lim | last post: by
reply views Thread by siLver | last post: by
2 posts views Thread by farukcse | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.