
October 27th, 2003, 10:18 AM
|
 |
Inherits Programmer.Slacker
|
|
Join Date: Aug 2003
Location: Between my Id and your Ego
|
|
I made a reference to the Access 10.0 Library, and then put the following the the form_load sub of a blank form.
Code:
Private Sub Form_Load()
Dim acAccess As Access.Application
Set acAccess = New Access.Application
'Point the file path to the database you want to export
acAccess.OpenCurrentDatabase "C:\Documents and Settings\Sheltonwade\Desktop\'.Net Lab'\Lab Examples\Labfiles\Lab111\Northwind.mdb", True
acAccess.DoCmd.TransferText acExportDelim, TableName:="Orders", FileName:="C:\Documents and Settings\All Users\Desktop\Exported File.txt"
End Sub
it put the file out to a comma delmited file as a .txt... you can also do it like this.
Code:
Private Sub Form_Load()
Dim acAccess As Access.Application
Set acAccess = New Access.Application
acAccess.OpenCurrentDatabase "C:\Documents and Settings\Sheltonwade\Desktop\'.Net Lab'\Lab Examples\Labfiles\Lab111\Northwind.mdb", True
acAccess.DoCmd.TransferText acExportDelim, TableName:="Orders", FileName:="C:\Documents and Settings\All Users\Desktop\Exported File.csv", hasfieldnames:=True
End Sub
and it will export as a Comma Separated File (csv) with the file names - and Excel will pick it up as an excel-native file
Good luck
__________________
Fisherman
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein
|