Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 22nd, 2005, 02:05 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delimited fields imported to one column in access

Hi,

I tried to import a text file(tab delimited) into an access database, through vba. the command is docmd.transfertext
However, after import i found that all the fieds in the input file, were being imported into one single column of an access table. I searched in google and saved a specification file. Now the import was successful.
But when i have multiple textfiles to be imported, with different number of fields, i cant use the same import specification. So i have to create a new import specification for each file. But that is cumbersome.

By using ADO, i could have done it, but it is lot of code, to find out the number of fields in the input file and then create a table with the same no of fields and then append data to the table.

Please let me know, if this can be handled differently using the docmd.transfertext command.
Can a single import spec be created for all the files

Reply With Quote
  #2 (permalink)  
Old February 23rd, 2005, 11:49 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you do this with with VBA/ADO instead of VBA/DoCmd.TransferText you get much better control, even though the code takes a bit longer to write.

mmcdonal
Reply With Quote
Reply


Thread Tools
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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit an imported template, where & how? ismailc XSLT 2 January 18th, 2008 02:50 AM
Displaying Table Column/Fields names in a listbox Durkee VB.NET 2002/2003 Basics 4 September 25th, 2007 03:37 PM
imported DLL functions in MFC atmosphere Visual C++ 0 June 4th, 2006 08:30 PM
How to access Simply Accounting fields from Access lguzman Access VBA 4 September 16th, 2004 02:55 PM
Upload tab delimited into Access? mariakovacs Classic ASP Databases 0 October 10th, 2003 10:54 AM



All times are GMT -4. The time now is 10:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.