Extract subform into excel (1 Viewer)

Joy83

Member
Local time
Today, 05:16
Joined
Jan 9, 2020
Messages
116
Hi all,
I have two subforms in one main form
Once you click on a field in subform1 it filters the results in subform2
I want to extract the resulted data in subform 2 in excel as is (as showing in the form)

i tried many things but it didn’t work. Can you plz help
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:16
Joined
Oct 29, 2018
Messages
21,447
Hi. Have you tried using the CopyFromRecordset method?
 

Joy83

Member
Local time
Today, 05:16
Joined
Jan 9, 2020
Messages
116
thanks for your reply
Can you refer me to a link I didn’t try this method
I was trying transferspreadsheet and outputto
 

Joy83

Member
Local time
Today, 05:16
Joined
Jan 9, 2020
Messages
116
This line is working fine except it brings all the subform (not the filtered one)
What to put instead “?” To make it transfer only the filtered data in the subform
DoCmd. Outputto ac outputform, ? , acformatxlsx
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:16
Joined
May 7, 2009
Messages
19,227
here is a demo.
if you need to adopt to your db, copy the 3 modules.
 

Attachments

  • ExportFilteredForm.accdb
    580 KB · Views: 327

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:16
Joined
Feb 19, 2002
Messages
43,196
Use a query to export the data. In the query, use a WHERE clause that references the first subform.

WHERE SomeField = Forms!yourmainform!yourfirstsubform!SomeField
 

Users who are viewing this thread

Top Bottom