How to change codes for OutputTo function (1 Viewer)

accessfever

Registered User.
Local time
Yesterday, 16:32
Joined
Feb 7, 2010
Messages
101
I have a simple VBA code to opoen a query based on an input of one "Plant number".

My code is as follow:
*****************************
Private Sub cmdOpenQuery_Click()
'Debug.Print Me.cboPlant <- Original code to enter a plant number
cboPlant = "1100"
DoCmd.OpenQuery "QtyDataByPlant"
End Sub
*****************************

What I wanted to accomplish here is to change the codes above to an "OutputTo" function with hard-coded 13 plant numbers inside the codes. I wanted to push the button then Access will export the query to 13 excel files automatically.

Any suggestion!
 

AccessBlaster

Registered User.
Local time
Yesterday, 16:32
Joined
May 22, 2010
Messages
5,993
I have a simple VBA code to opoen a query based on an input of one "Plant number".

My code is as follow:
*****************************
Private Sub cmdOpenQuery_Click()
'Debug.Print Me.cboPlant <- Original code to enter a plant number
cboPlant = "1100"
DoCmd.OpenQuery "QtyDataByPlant"
End Sub
*****************************

What I wanted to accomplish here is to change the codes above to an "OutputTo" function with hard-coded 13 plant numbers inside the codes. I wanted to push the button then Access will export the query to 13 excel files automatically.

Any suggestion!

This is my goto site for exporting to Excel. http://www.accessmvp.com/KDSnell/EXCEL_Export.htm

Good Luck,
Richard
 

accessfever

Registered User.
Local time
Yesterday, 16:32
Joined
Feb 7, 2010
Messages
101
Thanks! I changed my codes and it worked. There is one thing I don't like this transferspreadsheet command in whichthere is no preserved data format in excel file. I created an Excel macro to reformat the data columns.....
 

Users who are viewing this thread

Top Bottom