473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2827
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.Execu te line
Close #1
DoCmd.TransferT ext 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
2633
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 one extra field at the end of the file (importing txt file). I open the saved specification than add new name of the field and its specification, go through the entire process, and at least it reconginse that I have made changes to the spec, so...
1
8171
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 fields. 177 102003 16:43:12 102003 18:43:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 165 102003 17:43:12 102003 18:44:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 177 102003 16:41:18 102003 18:45:12 6OAG0ADP Y 0000 0000 0000 0000 61930...
2
1945
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 staging table with 3-key PK. When duplicates are attempting import, I receive a msgbox stating the number of records that violated the PK and asks if I want to continue.
6
3023
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 newsgroup forum, so this fact was fixed. Since I have to transfer files from VMS( SAS ) to WIN (Access), I still keep using ACC97 as a simplest and reliable tool. However, final products, such as distributable data entry system for multi central...
1
4013
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 user has the ability to upload a file (.txt or .csv). The data in the file may be comma delaminated, tab delaminated, fixed width etc (we don't know). What I'd like to create is something like MS Access uses to import an Excel file into the...
2
2042
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 the import specification. my syntax for file to import was \\ usrshare\ %username% \data\ foo.txt Any help would be appreciated d
1
4547
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: ThisFile2007-02-01 11.02.00.421.xls Is there a way a can create some sort of link that matches a pattern? If file name starts with 'ThisFile'
2
4731
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 also possible to use the TransferText method with such a specification as an argument. However, it's a complete pain having to save a different specification for every new file format.
4
3391
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 recognize the saved name as an import specification. Thanks for any help
0
8162
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8605
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8246
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8415
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7039
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6076
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4045
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4109
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.