PC Review


Reply
Thread Tools Rate Thread

Text File input Manipulation with ACCESS

 
 
=?Utf-8?B?UENCNFU=?=
Guest
Posts: n/a
 
      6th Oct 2004
Below is the file data I need to manipulate into an ACCESS database or a VB
database. Here's the TXT file:

================================
REFDES LIST
Harness Assembly: 2CWH33203-0010,-,1
Effectivity: 2AA:4-4, 2AA:5-5, 2AA:1-1, 2AA:6-9999, 2AA:3-3, 2AA:2-2
Date: 2004-09-17
Sheet number: 1
..
..
..
..
..
..
=================================

The following is needed

1) Read records 2,3 and 4 only

2) Manipulate RECORD 2 into 3 fields as follows
2CWH33203-0010,-,1 (part_num, rev, seq)

3) RECORD 3
For each comma delimited effectivity, 3 fields as follows
2AA, 4, 4 (variant, start, stop)
So for this particular RECORD 3 there would be the following fields:
2AA,4,4,2AA,5,5,2AA,1,1,2AA,6,9999,2AA,3,3,2AA,2,2 (variant, start,
stop, variant, start, stop.....)
RECORD 3 fileds would require until end of line for RECORD 3 (here is a
guess but the total field, multiples of 3 for this record, is 75)

4) RECORD 4
Extract date and place it in a cell

I have VB6 Professional

Thanks
Jay
(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Joe Fallon
Guest
Posts: n/a
 
      7th Oct 2004
You have to write code to do this.
The wizards expect data in a table like structure.
Your file is not in that format.

Here is a skeleton to get you started.

Public Sub ImportFile(strPath As String)

Dim db As Database, rs As Recordset
Dim sLine As String, sTrimmed As String
Set db = CurrentDb
Set rs = db.OpenRecordset("TableName", dbOpenTable)

Open strPath For Input As #1

'Read a single line from an open sequential file and assign it to a String
variable.
Line Input #1, sLine
'Trim the leading blanks
sTrimmed = LTrim(sLine)

Do While Not EOF(1)
'read the next line of the file
Line Input #1, sLine
sTrimmed = LTrim(sLine)

'manipulate the string if necessary, then add it to the rs table.
If rs.BOF = True Then
rs.AddNew
Else
rs.Edit
End If
rs.Update
Loop
End Sub



--
Joe Fallon
Access MVP



"PCB4U" <(E-Mail Removed)> wrote in message
news:F3A6DABD-CCBF-4878-9603-(E-Mail Removed)...
> Below is the file data I need to manipulate into an ACCESS database or a
> VB
> database. Here's the TXT file:
>
> ================================
> REFDES LIST
> Harness Assembly: 2CWH33203-0010,-,1
> Effectivity: 2AA:4-4, 2AA:5-5, 2AA:1-1, 2AA:6-9999, 2AA:3-3, 2AA:2-2
> Date: 2004-09-17
> Sheet number: 1
> .
> .
> .
> .
> .
> .
> =================================
>
> The following is needed
>
> 1) Read records 2,3 and 4 only
>
> 2) Manipulate RECORD 2 into 3 fields as follows
> 2CWH33203-0010,-,1 (part_num, rev, seq)
>
> 3) RECORD 3
> For each comma delimited effectivity, 3 fields as follows
> 2AA, 4, 4 (variant, start, stop)
> So for this particular RECORD 3 there would be the following fields:
> 2AA,4,4,2AA,5,5,2AA,1,1,2AA,6,9999,2AA,3,3,2AA,2,2 (variant, start,
> stop, variant, start, stop.....)
> RECORD 3 fileds would require until end of line for RECORD 3 (here is a
> guess but the total field, multiples of 3 for this record, is 75)
>
> 4) RECORD 4
> Extract date and place it in a cell
>
> I have VB6 Professional
>
> Thanks
> Jay
> (E-Mail Removed)



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word: Ghost text, keyboard, text manipulation PR Microsoft Word Document Management 3 19th Jun 2009 04:31 AM
Excel + user input + external data (URL manipulation) tehbloo@gmail.com Microsoft Excel Misc 2 28th Sep 2006 05:48 PM
Welcome input from all on manipulation of images/pictures! Epinn Microsoft Powerpoint 3 8th Aug 2006 06:51 AM
Text manipulation in Access =?Utf-8?B?Um9uZGE=?= Microsoft Access Reports 3 5th May 2006 01:37 PM
For better Performance in VBA for Excel - Strings manipulation OR Objects manipulation vmegha Microsoft Excel Programming 2 19th Dec 2005 01:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:59 AM.