473,396 Members | 1,749 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,396 software developers and data experts.

How to automate this import

Roy
Hello,
As a part of a data dump from a source,I will be getting a
text file which has to imported into Access table.

But the file dump from Unix is kinda convoluted and inspite of using
the line import method or with few pointers from previous posts,I am
unable to do so.

the file from unix is as below:

1000 NULL 33497 Sorborate and Internment
tank Hitilirect Plavdorm and Business Systems inte
Application Services Incident/Outage caused
by software failure. Incident/Outage caused by software failure.
Int BIB - Dash
Cash Management
Asia-Pacific New Hitisard customers unable to access
ATM & hitilirect |GitiNone Brisbane,
Australia| Yek-Ling Chong
|With joint effort from Singapo| Aug 12 2001 10:58PM
Non-critical (Yellow) Closed Fe Ganuelas
+612 822 51546 NULL
NULL
NULL
NULL NULL NULL NULL
NULL NULL
NULL NULL
NULL Jul 27
2001 3:30PM Aug 11 2001 8:00PM Not Implemented
NULL NULL
NULL ||
(GMT+10:00) East Australian Standard Time
NULL
NULL NULL NULL
NULL NULL
NULL NULL NULL

NULL



||

As you see,its follows no specified format.
Kindly help

Roy

Nov 13 '05 #1
8 1687
I'm not sure this reply will be much help, but here goes.

is there any way you can explain what all the fields/data are? (Or can
you get that from someone?) I just did something like this, but far
more understandable. but without a key of some kind to understand what
all these data are, it's nearly impossible to put the information in
any kind of logical order.

Nov 13 '05 #2
Roy
Hi,

Thanks for the reply but it did not contain your explanation.Also
to answer your point,there is no header information.the first fild is a
integer field and the rest are text.Does this help you?

Nov 13 '05 #3
Are the delimiters between the fields constant?
If you have that, you can read the lines one at a time and then use
Split to break the pieces into individual values.

You might need to create an array or something to hold the parsed
values before you write them to a recordset/table.

How much of this do you know how to do or need help with?

Nov 13 '05 #4
Roy
This is the code i used which was from one of the Access gurus on this
group.The code works till before the recordset,RS2.
After that it bombs with a error saying "item not found".I tried to add
additional fields but to no avail.

DataFeed_001 is a table with a single memo field .Feed _002 is the
final table to which the data is parsed.

Private Sub cmdimportText_Click()

Dim db As DAO.Database, i As Integer, j As Integer
Dim k As Integer, m As Integer, n As Integer, p As Integer
Dim RS1 As DAO.Recordset, RS2 As DAO.Recordset
Dim SourceDoc As String, str1 As String

DoCmd.SetWarnings False
DoCmd.OpenQuery "FeedDelete"
DoCmd.SetWarnings True

Set db = CurrentDb
Set RS1 = db.OpenRecordset("DataFeed_001")
SourceDoc = "C:\Roy\DataFeed.txt"
Open SourceDoc For Input As #1
i = 0
Do While Not EOF(1)
Line Input #1, str1
RS1.AddNew
RS1(0) = str1
RS1.Update
RetVal = SysCmd(acSysCmdSetStatus, i)
i = i + 1
Loop
Close #1
RS1.MoveFirst

Set RS2 = db.OpenRecordset("Feed_002")
Do While Not RS1.EOF
str1 = RS1(0)
i = 1
j = 1
RS2.AddNew
For k = 0 To RS2.Fields.COUNT - 1
j = InStr(i, str1, " ")
m = Len(str1) - (Len(str1) - j)
p = m - i
str2 = Trim(Mid(str1, i, p))
RS2(k) = str2
i = j + 1
Next
j = Len(str1) - i - 1
str2 = Right(Trim(str1), j)
RS2(k) = str2 ' --this is the last column in table------it bombs
here................
RS2.Update
RS1.MoveNext
RetVal = SysCmd(acSysCmdSetStatus, "Parsing " & n)
n = n + 1

Loop
RS1.Close
RS2.Close
End Sub

Thanks

Nov 13 '05 #5
My two-penneth, I use a program called Textpad which is basically a
text editor but extremely powerfull. You can create macros to
manipulate your data ie comma delimenate fields, block select/deklete
bioth horizontally & vertically etc. Definitely worth a look.

Regards

Nov 13 '05 #6
My two-penneth, I use a program called Textpad which is basically a
text editor but extremely powerfull. You can create macros to
manipulate your data ie comma delimenate fields, block select/deklete
bioth horizontally & vertically etc. Definitely worth a look.

Regards

Nov 13 '05 #7
Roy
Textpad?

Nov 13 '05 #8
Roy
RichP,
This was the code I used which was suggested by you.Can you
help me here?

The code works till before the recordset,RS2. After that it bombs with
a error saying "item not found in this collection".I tried to add
additional fields but to no avail.
DataFeed_001 is a table with a single memo field .Feed _002 is the
final table to which the data is parsed.
Private Sub cmdimportText_Click()
Dim db As DAO.Database, i As Integer, j As Integer
Dim k As Integer, m As Integer, n As Integer, p As Integer
Dim RS1 As DAO.Recordset, RS2 As DAO.Recordset
Dim SourceDoc As String, str1 As String
DoCmd.SetWarnings False
DoCmd.OpenQuery "FeedDelete"
DoCmd.SetWarnings True
Set db = CurrentDb
Set RS1 = db.OpenRecordset("DataFeed_001*")
SourceDoc = "C:\Roy\DataFeed.txt"
Open SourceDoc For Input As #1
i = 0
Do While Not EOF(1)
Line Input #1, str1
RS1.AddNew
RS1(0) = str1
RS1.Update
RetVal = SysCmd(acSysCmdSetStatus, i)
i = i + 1
Loop
Close #1
RS1.MoveFirst
Set RS2 = db.OpenRecordset("Feed_002")
Do While Not RS1.EOF
str1 = RS1(0)
i = 1
j = 1
RS2.AddNew
For k = 0 To RS2.Fields.COUNT - 1
j = InStr(i, str1, " ")
m = Len(str1) - (Len(str1) - j)
p = m - i
str2 = Trim(Mid(str1, i, p))
RS2(k) = str2
i = j + 1
Next
j = Len(str1) - i - 1
str2 = Right(Trim(str1), j)
RS2(k) = str2 ' --this is the last column in table------it bombs
here................
RS2.Update
RS1.MoveNext
RetVal = SysCmd(acSysCmdSetStatus, "Parsing " & n)
n = n + 1
Loop
RS1.Close
RS2.Close
End Sub
The file from Unix is below"
the file from unix is as below:
1000 NULL 33497 Sorborate and
Internment
tank Hitilirect Plavdorm and Business Systems inte
Application Services Incident/Outage caused

by software failure. Incident/Outage caused by software failure.
Int BIB - Dash
Cash Management
Asia-Pacific New Hitisard customers unable
to access
ATM & hitilirect |GitiNone Brisbane,
Australia| Yek-Ling Chong
|With joint effort from Singapo| Aug 12 2001 10:58PM
Non-critical (Yellow) Closed Fe
Ganuelas
+612 822 51546
NULL
NULL
NULL
NULL NULL NULL
NULL
NULL NULL
NULL NULL
NULL
Jul 27
2001 3:30PM Aug 11 2001 8:00PM Not Implemented
NULL NULL
NULL ||
(GMT+10:00) East Australian Standard Time
NULL
NULL NULL
NULL
NULL NULL
NULL NULL NULL
NULL
||

Nov 13 '05 #9

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

Similar topics

2
by: N. Graves | last post by:
I'm planning to develop a process to import data from an external flat file to a new table automatically. As usual I'm having a hard time getting started on the solution because of the Access's...
0
by: Chanus | last post by:
Hi experts, Can anyone tell me how I can automate "Get External Data" command to import a XML file? I'm looking to build a macro in ACCESS. Any help will be greatly appreciated. Thanks again.
3
by: John Marble | last post by:
I have around 400 excel files filled with data that I need to import in ACCESS. The tricky part is that they must be imported one at time, and properly corrected before importing the next one. I...
2
by: Phil Latio | last post by:
We have despatch process which kicks out picking information into text files at hourly intervals. The text files are named sequentially by process; 'ABC.txt', 'ABC01.txt', 'ABC02.txt' for one...
0
by: Jill Elaine | last post by:
I want to automate the import of 5 encrypted .db (Paradox) tables into a MS Access 2002 database every time the Access database is opened. I think I could use the TransferDatabase method to import...
11
by: David Lozzi | last post by:
Hello, I need to automate importation of a excel file into a table. Here's my scenario: I'm writing an ASP.NET application where users can pull reports on imported data. The imported data is...
3
by: D | last post by:
I would like to write a program that will automate the configuation of a firewall or router via HTTPS. So, I need to import the applicable certificate, and be able to configure the unit as if I...
1
by: sklett | last post by:
I've never tried to use windows messages to automate an application, but I've read some different blogs and articles that talk about sending keyboard input and mouse input. I wanted to describe...
5
by: NarayanaR | last post by:
Hello, I'm new to Office(!) but not to programming. I have a requirement that I'm struggling to solve: 1. In Access, I import a List from a sharepoint site as a linked table. 2. I delete all...
0
by: ishay44 | last post by:
Hello! I try to build (using Visual 2005 and Excel 2007) the example described in the Microsoft Help and Support "How to automate Excel from MFC and Visual C++ 2005 or Visual C++ .NET to fill or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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,...

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.