469,275 Members | 1,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

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

-cassey
Jan 23 '07 #1
9 10460
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
nico5038
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 ?

Nic;o)
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
nico5038
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 ?

Nic;o)
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
nico5038
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.

Nic;o)
Jan 24 '07 #7
nico5038
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.

Nic;o)
Jan 24 '07 #8
Hi,
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:
limbersti.cz/A2EE/
BR
Norbert
Jun 9 '12 #9
zmbd
5,400 Expert Mod 4TB
see if this helps
http://www.accessmonster.com/Uwe/For...bform-to-Excel

Search TransferSpreadsheet on this forum for info there.
You might start here:
http://bytes.com/topic/access/answer...to-rename-file
-z
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 zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.