Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2005, 03:05 AM
Registered User
 
Join Date: Feb 2005
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

 
Old February 23rd, 2005, 12:49 PM
Friend of Wrox
 
Join Date: Mar 2004
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit an imported template, where & how? ismailc XSLT 2 January 18th, 2008 03: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.