Export main form record along with subform records to Excel? (1 Viewer)

burma

Member
Local time
Yesterday, 23:33
Joined
Jan 17, 2024
Messages
50
So I have the main form with the one record, and the subform with related records. I want to export the main form record as a header in Excel, and the subform records as rows below that. Anyone know how to do that or have an example? Thx
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:33
Joined
Oct 29, 2018
Messages
21,613
I use automation. It works well especially when you apply filters to the forms. Check out the CopyFromRecordset method in Excel.
 

burma

Member
Local time
Yesterday, 23:33
Joined
Jan 17, 2024
Messages
50
I use automation. It works well especially when you apply filters to the forms. Check out the CopyFromRecordset method in Excel.
Do you use CopyFromRecordset from the Access side or from Excel? Do you have an example? Thx
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:33
Joined
Sep 21, 2011
Messages
14,607
Do you use CopyFromRecordset from the Access side or from Excel? Do you have an example? Thx
Well if you are exporting from Access then I would have thought from the Access side?

Plenty of examples out there. Just use Google to find some.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:33
Joined
Oct 29, 2018
Messages
21,613

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:33
Joined
Feb 19, 2002
Messages
43,720
So I have the main form with the one record, and the subform with related records. I want to export the main form record as a header in Excel, and the subform records as rows below that. Anyone know how to do that or have an example? Thx
You might want to post an excel example of how you think the output should look because alternating rows with different values in the same column will look chaotic.
 

burma

Member
Local time
Yesterday, 23:33
Joined
Jan 17, 2024
Messages
50
I'm not really sure. I was thinking of having the main form record in a "header section" at the top, and related child records in rows below it. Like what a form/subform displays in Access. But for now, I'm just dumping the raw non-deduplicated data into Excel. Thanks
 

Users who are viewing this thread

Top Bottom