Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 27th, 2003, 08:46 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
export DB to txt file question

I want to export entire tables at a time within my Access database. I also want to use a delimiter. What is the easiest way for me to do this one table at a time? I will probably have about 5 or 6 tables.

Reply With Quote
  #2  
Old October 27th, 2003, 10:18 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,171 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 37 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > export DB to txt file question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway