ACCESS TO EXCEL EXPORTATION coming through in a random order (Office 10)

R_McCallan

New Member
Joined
Aug 17, 2010
Messages
9
I have exported some data from Access to Excel (2010) and once exported to access the data is in a different order from when it was in the query. The data is all under the correct headers but each column is randomly ordered.

The query is in the following order (by fieldnames) CompanyName, CompanyAddress, TownCity, Postcode, ContactNumber1, WebsiteAddress, VATNumber, CompanyContact and CompanyType. The export comes out in this order (by header names) CompanyAddress, CompanyContact, CompanyName, CompanyType, ContactNumber1, Postcode, TownCity, VATNumber, WebsiteAddress.

There is an intermediary table which may be affecting the order, tbl_ExportDetails gives the fieldnames new header names for the export (I have used the original field names above so as not to confuse). Within the export details table, the fields are in the same order as in the original query so I don't see why they have been randomised!

Any help is much appreciated

Thanks
Rebecca.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi, Rebecca

If it is like Excel 2003 & earlier, just rearrange the columns to the order you want in the destination worksheet. They should stay in that order and all be OK.

HTH, F
 
Upvote 0
Hi,

Thanks for the reply

Yes that will work but I was wondering if there was a way to automatically put them back in the correct order? Otherwise when a customer is using the system they will have to reorder the fields each time.

Rebecca
 
Upvote 0
OK, Rebecca.

I was wrong before; my answer must seem rather stupid, actually. I was on the 'wrong track' thinking you had a query in Excel importing the data.

I now appreciate that you have an Access export. Excel is almost incidental. Maybe if you don't get a good answer in this forum [Excel], ask again in the Access sub-forum?

I am not familiar with exporting from Access. So I can't answer your question. I'm sure there must be many ways to export data from Access so it might be best to describe the approach taken. For example, I can imagine if you've written a query the intermediate step is unnecessary if it just renames headers as this can be done in SQL. And this should also re-set the field order to whatever you define in the SQL. As in,

Code:
SELECT field_X AS [New name], field_M AS [its new name], field_A
FROM table

Or even better, "SELECT * INTO etc". Please refer to http://support.microsoft.com/kb/295646 and
http://www.xtremevbtalk.com/showthread.php?t=217783

I'm guessing though that you're not using ADO, and hopefully someone familiar with Access exports will give you the answer.

regards, F
 
Upvote 0
Ok thanks for trying! No I am not using ADO I'm using DAO. I thought I'd post it in here because I thought it may be more the Excel side which was causing the problem.

Thanks anyway

Rebecca :biggrin:
 
Upvote 0
OK, Rebecca.

Normally exports are in the same order. The fact that this one isn't must be due to the steps taken. The steps need to be explained. Please describe the steps taken, the DAO, the extra table, the SQL, the code, etc.

It is a surprise that the fields are in a random order. (So, a different order on successive exports, I assume.)

Are any fields not renamed? Do they always appear first or also randomly.

Maybe if you post sample data too, it will help. See if others get the same randomness, or maybe someone can spot a pattern to it.

As I don't use Excel or Access after 2003 I will not be able to assist further.

regards, F
 
Upvote 0

Forum statistics

Threads
1,214,403
Messages
6,119,309
Members
448,886
Latest member
GBCTeacher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top