473,804 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading Text Files - Dev

Roy
I use a Access 2K application.I am trying to use Chuck
Grimsby(clsRead TextFile.txt)cl ass utility to read a text file and then
do a import of the same into my database.The question is how to call
these in a button event or any other method.

Thanks,
Roy

Nov 13 '05
16 4812
Sorry about that. It should read like this:

...
Set RS2 = db.OpenRecordse t("tblParsedDat *a")
Do While Not RS1.EOF
str1 = RS1(0)

RS1 is the raw data table. Each field in RS1 contains the entire row
picked up from the textfile. It is the row that you are parsing based
on whatever your field delimeter is in the textfile.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #11
Sorry about that. It should read like this:

...
Set RS2 = db.OpenRecordse t("tblParsedDat *a")
Do While Not RS1.EOF
str1 = RS1(0)

RS1 is the raw data table. Each field in RS1 contains the entire row
picked up from the textfile. It is the row that you are parsing based
on whatever your field delimeter is in the textfile.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #12
On 4 Aug 2005 06:01:36 -0700, "Roy" <pr********@yah oo.com> wrote:
Obviously I am doing something wrong here.I imported your
clsReadTextFil e.txt to the MyDocuments folder.I pasted the code
Application.Lo adFromText acModule,"clsRe adTextFile",
"clsReadTextFi le.txt"
,but it errors ,saying ,it cannot read the clsReadTextFile .txt .Can you
please detail the steps how to go about the whole thing,please.
The text file i need to use is EMSTestFeed.txt .
Where do i fit this in your code?How do i read your class from the VBA
module.

Well, step 1 is to get the class into your Access DB. If that can't
be done (and it only has to be done _once_), then nothing will help
you any further.

Hmmm.... _Where_ did you paste the "Application.Lo adFromText..."
part? You _cannot_ do it in the code module. It _must_ be done in
the Immediate window. Nowhere else will work, or do. Note: This part
is not something you have to _every time_, it's just a one time thing
to get the class module into your project. (Rather like creating a
Form. Generally, you only have to create it once.)

The name of the text file you are trying to read doesn't matter at
this point. We'll take care of that after you have the
clsReadTextFile class module in your database.

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Nov 13 '05 #13
On 4 Aug 2005 06:01:36 -0700, "Roy" <pr********@yah oo.com> wrote:
Obviously I am doing something wrong here.I imported your
clsReadTextFil e.txt to the MyDocuments folder.I pasted the code
Application.Lo adFromText acModule,"clsRe adTextFile",
"clsReadTextFi le.txt"
,but it errors ,saying ,it cannot read the clsReadTextFile .txt .Can you
please detail the steps how to go about the whole thing,please.
The text file i need to use is EMSTestFeed.txt .
Where do i fit this in your code?How do i read your class from the VBA
module.

Well, step 1 is to get the class into your Access DB. If that can't
be done (and it only has to be done _once_), then nothing will help
you any further.

Hmmm.... _Where_ did you paste the "Application.Lo adFromText..."
part? You _cannot_ do it in the code module. It _must_ be done in
the Immediate window. Nowhere else will work, or do. Note: This part
is not something you have to _every time_, it's just a one time thing
to get the class module into your project. (Rather like creating a
Form. Generally, you only have to create it once.)

The name of the text file you are trying to read doesn't matter at
this point. We'll take care of that after you have the
clsReadTextFile class module in your database.

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Nov 13 '05 #14
Roy
Rich,
Almost there!!That took care of it.But i get another error at this
line saying that
"Item not found in this collection"

Error is at this point:

RS2(k) = str2 ' --this is the last column in table
RS2.Update
RS1.MoveNext
RetVal = SysCmd(acSysCmd SetStatus, "Parsing " & n)
n = n + 1

Loop
RS1.Close
RS2.Close

Thanks,
Roy

Rich P wrote:
Sorry about that. It should read like this:

..
Set RS2 = db.OpenRecordse t("tblParsedDat *a")
Do While Not RS1.EOF
str1 = RS1(0)

RS1 is the raw data table. Each field in RS1 contains the entire row
picked up from the textfile. It is the row that you are parsing based
on whatever your field delimeter is in the textfile.

Rich

*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #15
Roy
Rich,
Almost there!!That took care of it.But i get another error at this
line saying that
"Item not found in this collection"

Error is at this point:

RS2(k) = str2 ' --this is the last column in table
RS2.Update
RS1.MoveNext
RetVal = SysCmd(acSysCmd SetStatus, "Parsing " & n)
n = n + 1

Loop
RS1.Close
RS2.Close

Thanks,
Roy

Rich P wrote:
Sorry about that. It should read like this:

..
Set RS2 = db.OpenRecordse t("tblParsedDat *a")
Do While Not RS1.EOF
str1 = RS1(0)

RS1 is the raw data table. Each field in RS1 contains the entire row
picked up from the textfile. It is the row that you are parsing based
on whatever your field delimeter is in the textfile.

Rich

*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #16
Hi Roy,

Try adding one more column to your ParsedData table. I think you are
probably short one column.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #17

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

Similar topics

2
2805
by: dunnm | last post by:
This is probably a more appropriate location to post this question. I should have know that since I've found most of the other PHP/PDF information contained in this group. Here's my issue...I will from time to time receive 4 - 5 PDF files into a directory; I want to be able to schedule a task which will pick up these 4 - 5 PDFs, read through them and then generate 1 pdf. Creating PDFs in PHP is obviously fairly easy, however I haven't...
19
10387
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much text is available until I have read it... which seems to imply that multiple reads of the input stream will be inevitable. Now I can correctly find the number of characters available by: |
1
6764
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but listen up; Reports, the way I look at them, all present data downwards, in this way; TITLE data
50
5048
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem -- the character input is a different matter, at least if I want to remain within the bounds of the standard library.
40
4623
by: googler | last post by:
I'm trying to read from an input text file and print it out. I can do this by reading each character, but I want to implement it in a more efficient way. So I thought my program should read one line at a time and print it out. How can I do this? I wrote the code below but it's not correct since the fscanf reads one word (terminating in whitespace or newline) at a time, instead of reading the whole line. #include <stdio.h> void...
1
1955
by: Hutty | last post by:
I have a program that open text files and compares them, however, when reading files larger than 500kb the programs seems to bomb. I get re-directed to "page not found". Any idea how to get around this issue? Ultimate goal is to read text files as big as 50mb or more. I'm using the "input type=file " to upload file, and then using Streamreader to read the text. Thanks -- Hutty
2
11655
by: Eshban Bahadur | last post by:
Hello, I want to read (RTF) files in my VB.NET programme. How can i do it. I apply the same method of reading text files, but it does not save the formatting of text like (bold, italics, underline) etc. So , how can i make programme which allows me to read (RTF) Rich Text Format files or Microsoft WORD files in VB.NET through FILE HANDLING. Plz help me
6
5278
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
2
3234
by: Wes Peters | last post by:
Does anyone know of an article that deals with the subject of reading a structured text file using VBA code in Access? Thanks, Wes
7
3068
by: random guy | last post by:
Hi, I'm writing a program which creates an index of text files. For each file it processes, the program records the start and end positions (as returned by tellg()) of sections of interest, and then some time later uses these positions to read the interesting sections from the file.
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7634
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
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.