473,406 Members | 2,956 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,406 software developers and data experts.

import a textfile with vba

Hello,

I'm trying to import a textfile into an Access table. I want
to write a macro to do all the work automatically.

My textfile looks like that:
artNr;description;sellingValue
111111;top;0.34

The different colums are divided by ";" and the sellingValue is a
double datatype which is divided by ".".

I want to to create a table that looks like that:
artNr description sellingValue
111111 top 0,34

--------------
Datatypes:
artNr = text
description = text
sellingValue = double

Thanks a lot,
Mibi
Nov 13 '05 #1
4 5279
HJ
There are several ways to do this. One is to use the Open and Input
commands, e.g.

Open YourTextFile.txt For Input As 1

For each line: Input #1, strInput until you meet an empty line (strInput="")
or error 62 (end of file).

Then you can split each line by searching for the ; characters.

HJ

<mi******@gmx.de> wrote in message
news:77**************************@posting.google.c om...
Hello,

I'm trying to import a textfile into an Access table. I want
to write a macro to do all the work automatically.

My textfile looks like that:
artNr;description;sellingValue
111111;top;0.34

The different colums are divided by ";" and the sellingValue is a
double datatype which is divided by ".".

I want to to create a table that looks like that:
artNr description sellingValue
111111 top 0,34

--------------
Datatypes:
artNr = text
description = text
sellingValue = double

Thanks a lot,
Mibi

Nov 13 '05 #2
Hmmmm, sounds like your looking to hard for the answer, search the
access help for the DoCmd.TransferText command, this will import or
export text files fairly simply.
Nov 13 '05 #3
use TransferText and create an import specification. Much easier.
Nov 13 '05 #4
Just go file->get external data, and follow the wizard.

You should be able to import this data with no code at all. The import
ability of ms-access is quite good, and likely you don't need any code here.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #5

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

Similar topics

1
by: Larry Rekow | last post by:
I have a report that's created each day as a flat textfile. Because I came from the Access world, I created a macro that imports it with a schema that gives meaningful names to the various...
3
by: Elaksomfan | last post by:
Hi, I am having trouble importing data from an excel spreadsheet into MS SQL Server 2000 using DTS Wizard. The DTS import process is successfull, no errors, but only 50 rows of approx. 1500 rows...
2
by: Sigurd Bruteig | last post by:
Hi all! With the transferText method I have made a routine that import a textfile to a table.The textfile is a pricelist from the supplier. The problem is that the supplier uses . (dot) as...
1
by: ghadley_00 | last post by:
Hi, I have a MS access database table for which I regularly need to import fixed width text data. At present I have to to cut and paste the text data from its source to a text file, save the...
1
by: Supersonic | last post by:
I’m a dba for a SQL and I’m trying to learn how to import data from a simple text file. The text file looks like "1, name" "2, name2" and so on. How is it possible to solve this import with python?...
1
by: joel.sjoo | last post by:
I'm a dba for SQL server and I Will import a textfile to SQL. For example I use a file with 3 columns. ID, Name and Surname and the columns are tab separated. I don't know much about programming....
2
by: arunaksha7 | last post by:
I am new to ASP.NET. I am facing a problem to import contents of a textfile to my ASP.NET Web Application datagrid.
9
by: a | last post by:
Dear friends I want import data from CSV file to mdb file How can I do that in vb.net?
5
by: kashif73 | last post by:
I have a text file with hundreds of records. each line contain 1250 values seperated by a semicolon. I have created 2 tables in SQL server 2000, one with 1000 columns & the second with 250 columns....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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
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...
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,...
0
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...

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.