Export a form's records to an Excel spreadsheet

P

Patrick386

Hello!
Is it possible to export a the content of a continuous form that is linked to a recordsource directly to Excel? to have the same result as File menu, Print Preview. Tools menu, Office Links, Analyze it with Microsoft Excel.

I have tried this but it does export to an Excel file, but it is attached to an email :(

Docmd.SendObject AcSendForm, Me.Name, acFormatXLS

Thanks for your help!
 
O

OldPro

Hello!
Is it possible to export a the content of a continuous form that is linked to a recordsource directly to Excel? to have the same result as File menu, Print Preview. Tools menu, Office Links, Analyze it with Microsoft Excel.

I have tried this but it does export to an Excel file, but it is attached to an email :(

Docmd.SendObject AcSendForm, Me.Name, acFormatXLS

Thanks for your help!

Use TransferSpreadsheet( ) to create an excel file from a recordset,
and then RunApp to start Excel.
 
G

Guest

Not directly. You will need to create a query that will return the same
records as the form's recordset and export it that way.
 
P

Patrick386

Cool, didn't know this one..
the only thing that I cannot do with this function is to put an select sql
statement int the argument "TableName"

Thanks again for your help. I will see if I really need that I create an
Excel object to do it

Best regards
 
O

OldPro

Cool, didn't know this one..
the only thing that I cannot do with this function is to put an select sql
statement int the argument "TableName"

Thanks again for your help. I will see if I really need that I create an
Excel object to do it

Best regards

"OldPro" <[email protected]> a écrit dans le message de (e-mail address removed)...





- Show quoted text -

Yeah, you need to use an INSERT INTO to copy a recordset into a
temporary table first...
 
P

Pieter Wijnen

you *can* export a query to

Pieter

Cool, didn't know this one..
the only thing that I cannot do with this function is to put an select sql
statement int the argument "TableName"

Thanks again for your help. I will see if I really need that I create an
Excel object to do it

Best regards

"OldPro" <[email protected]> a écrit dans le message de (e-mail address removed)...





- Show quoted text -

Yeah, you need to use an INSERT INTO to copy a recordset into a
temporary table first...
 
P

Patrick386

Great thanks for all your help!
after all, I'll use

Docmd.OutputTo ...

I'll only need to create a temporary QueryDef object, export and than erase
the query def. Plus this function ask the user where to store the file if
omitted. so I won't need to take care of it

Cool


"Pieter Wijnen"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top