Extract subform into excel (1 Viewer)

Joy83

Member
Local time
Today, 12:00
Joined
Jan 9, 2020
Messages
108
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, 12:00
Joined
Oct 29, 2018
Messages
19,186
Hi. Have you tried using the CopyFromRecordset method?
 

Joy83

Member
Local time
Today, 12:00
Joined
Jan 9, 2020
Messages
108
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, 12:00
Joined
Jan 9, 2020
Messages
108
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
Tomorrow, 03:00
Joined
May 7, 2009
Messages
16,843
here is a demo.
if you need to adopt to your db, copy the 3 modules.
 

Attachments

  • ExportFilteredForm.accdb
    580 KB · Views: 236

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:00
Joined
Feb 19, 2002
Messages
36,912
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