If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Automatic export query to (formatted) Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-11, 06:34
Rob_Belgium Rob_Belgium is offline
Registered User
 
Join Date: Sep 2011
Posts: 2
Automatic export query to (formatted) Excel

Hi Access giants,

I would like to run a query in Access (button on a form) with the possibility to automatically export the results to a formatted Excel file with functions like 'wrap text', colored headings etc. I also noticed that for example values (columns) with type 'time' are shown as 1-1-1900 in excel after export.
Who can help me out?

Thanks all in advance for your help.

Cheers,

Rob, Belgium
Reply With Quote
  #2 (permalink)  
Old 09-30-11, 11:38
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
For this sort of export, I generally use a recordset to hold the data going out, use the Excel library to allow Access to control Excel objects and a loop to populate the spreadsheet.

You can then create a new workbook object, pick a sheet from that workbook and format it how you need, and control which fields from the recordset go where in the worksheet.
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
  #3 (permalink)  
Old 10-12-11, 08:45
Rob_Belgium Rob_Belgium is offline
Registered User
 
Join Date: Sep 2011
Posts: 2
Thanks!

Thanks for your help! You've saved me
Reply With Quote
  #4 (permalink)  
Old 10-12-11, 09:07
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You're welcome! Glad to know that it helped
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
Reply

Tags
excel, export, format, query

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On