473,395 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Import Specification Help

Hello all

Here is a puzzle I hope someone has a solution for. I am trying to import
a delimited text file using a Visual Basic 'TransferText' command. So that
the table is created properly I have an Import Specification set up and it
seem to work ok. I have a new text file every day to load - when I have
finished using the information in it - I have a macro which deletes the
table. Here is my problem. I have set the specification so that the first
row of my Text File is used as field names. Five of the field names change
each day to reflect the next five days date. When I import the first time
it works - but on subsequent days my field names remain the same as the
first time. Is there a way to tell my code to reload the field names from
each new file?

I hope thats clear - gets a bit confusing. Any assistance would be
appreciated.

Thanks

Shaun H
Nov 13 '05 #1
1 2813
On Thu, 07 Apr 2005 00:52:58 GMT, Shaun Harwood
<Sh***********@sympatico.ca> wrote:
Hello all

Here is a puzzle I hope someone has a solution for. I am trying to import
a delimited text file using a Visual Basic 'TransferText' command. So that
the table is created properly I have an Import Specification set up and it
seem to work ok. I have a new text file every day to load - when I have
finished using the information in it - I have a macro which deletes the
table. Here is my problem. I have set the specification so that the first
row of my Text File is used as field names. Five of the field names change
each day to reflect the next five days date. When I import the first time
it works - but on subsequent days my field names remain the same as the
first time. Is there a way to tell my code to reload the field names from
each new file?

I hope thats clear - gets a bit confusing. Any assistance would be
appreciated.

Thanks

Shaun H

You can get the field names from the file's first line, create a table
using these and import without fieldnames

Sub import()
Dim line$, filename$
filename = ' something
Open filename For Input As #1
Line Input #1, line
line = Replace(line, """", "")
' removes surrounding textkvalifiers
line = "create table Mytable( " & _
Replace(line, ";", " text,") & " text)"
CurrentDb.Execute line
Close #1
DoCmd.TransferText acImportDelim, "specname", _
"Mytable", filename, False
End Sub

--
Benny Andersen
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: B.Desai | last post by:
Hello Experts, Can you please help me out? I am very frustrated! I am trying to update import specification, and it does not let me do that. I have saved specification and now I need to add...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
2
by: ms | last post by:
In Access 2000, I am using... 'Import Raw text to stageBMIDLog table. DoCmd.TransferText acImportFixed, "BMIDLog Link Specification", "stageBMIDLog", file ....to import raw records into a...
6
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
1
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
2
by: M Cavanagh | last post by:
I need to reference each user's (many) home share on a network and tried using the Wndows %username% to do so but this did not work to reference the directory where my import tables will be using...
1
by: Steve | last post by:
Hi All, I have an Excel file being delivered to a shared drive where I only have read access on a daily basis. The files arrive in the following format 'Filename+timestamp.xls' Example:...
2
by: MIG | last post by:
I am aware that when importing a file it's possible to save a specification that says, for example, treat a particular field as text, whenever importing a file of exactly the same format. It's...
4
by: davjoh123 | last post by:
I have saved an import and it works great. I would like to be able to start the saved import from a button on a switchboard. I tried using TransferText and the saved import name but it does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.