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_C lick()
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.SetWarnin gs False
DoCmd.OpenQuery "FeedDelete "
DoCmd.SetWarnin gs True
Set db = CurrentDb
Set RS1 = db.OpenRecordse t("DataFeed_001 **")
SourceDoc = "C:\Roy\DataFee d.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(acSysCmd SetStatus, i)
i = i + 1
Loop
Close #1
RS1.MoveFirst
Set RS2 = db.OpenRecordse t("Feed_002")
Do While Not RS1.EOF
str1 = RS1(0)
i = 1
j = 1
RS2.AddNew
For k = 0 To RS2.Fields.COUN T - 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(acSysCmd SetStatus, "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
|| 4 1583
You don't have that assignment inside your for...next loop. By the time you
execute it, k will be past that last field in your table.
(RS2.Fields.Cou nt -1) is the last field in the table. Suppose you have 3
fields...(RS2.F ields.Count would equal 3) RS2(0) is the first, RS(1) is the
second, RS(2) would be the last field.
So, if you want to assign a value to the last field in the table, use:
RS2(RS2.Fields. Count - 1) = str2 ' Don't use a For...Next index outside of
the For...Next loop!
"Roy" <pr********@yah oo.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
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_C lick()
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.SetWarnin gs False
DoCmd.OpenQuery "FeedDelete "
DoCmd.SetWarnin gs True
Set db = CurrentDb
Set RS1 = db.OpenRecordse t("DataFeed_001 **")
SourceDoc = "C:\Roy\DataFee d.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(acSysCmd SetStatus, i)
i = i + 1
Loop
Close #1
RS1.MoveFirst
Set RS2 = db.OpenRecordse t("Feed_002")
Do While Not RS1.EOF
str1 = RS1(0)
i = 1
j = 1
RS2.AddNew
For k = 0 To RS2.Fields.COUN T - 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(acSysCmd SetStatus, "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
||
Randy,
Thanks much for the reply.Now it does'nt come with
the error like "Item not found in this collection,but it says
"field too small to accept the data".Obviously it is not splitting the
memo field ?
This is my corrected code as suggested by you:
For k = 0 To RS2.Fields.COUN T - 1
j = InStr(i, str1, " ")
m = Len(str1) - (Len(str1) - j)
p = m - i
str2 = Trim(Mid(str1, i, p))
'str2 = Split(str1, Chr(9))
RS2(k) = str2
'RS2(RS2.Fields .COUNT - 1) = str2
i = j + 1
Next
j = Len(str1) - i - 1
str2 = Right(str1, j)
'str2 = Split(str1, Chr(9))
'RS2(k) = str2 ' --this is the last column in table
RS2(RS2.Fields. COUNT - 1) = str2
Is this okay?I did not get the line about the For..Next loop .Can you
explain.
Thanks,
Roy
when the code fails, what is the line it fails on? What field is being
written? What are your field sizes in your table? The problem seems
obvious - you might want to throw some code in there to determine where
the failure is occurring - either throwing in some real error trapping
or doing something like using Debug.Print to write the field name and
the value you're trying to write into it. then the fix should be
obvious.
Thanks for your comments,but maybe you fail to understand the
problem.There is one table with one memo filed where all
the text fields are read into.Then there is a second table with
required number of fields to which the data from table is parsed into.
If you can and have time,kindly copy and paste the text file i have
pasted and also the code which i use.The datatype in second table is
all text. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Adam |
last post by:
I've posted about this previously, but failed to receive
a satisfactory response, so have included a code sample:
I am trying to receive messages from an HTML viewer
control in compact.net (c#), but cannot use message
window as the control's parent window, as this is
invisible and so the html is not viewable!
I have a code sample showing the problem at
www.tenwisevirgins.com/Example.zip
|
by: Sabin Finateanu |
last post by:
Hi I'm having problem reading a file from my program and I think it's from a
procedure I'm using but I don't see where I'm going wrong. Here is the code:
public bool AllowUsage()
{
OperatingSystem os = Environment.OSVersion;
AppDomain ad = Thread.GetDomain();
|
by: JoeS |
last post by:
Is there anyway to share a single pch file between
projects in VC 7.0? I have 300+ projects each of which
creates its own pch. All projects include the exact same
header files in the precompiled header. Its takes about 7
seconds to create the precompiled header for each project.
That's 35 minutes spent creating precompiled headers for
all project! All of the projects use PDB files for debug
info.
I tried creating Precomp.pch in project...
|
by: Doug |
last post by:
This is a repost of an item that I still cannot resolve.
I have 3 combo boxes. The first leads to the second to the third.
When I have selected a value in the second box, the third box shows the
available information based on the second combo box selection. But if I
change my mind and select a different item in the second box, after the
third box has been populated, the third box still retains the information
that was previously...
|
by: Steve McLellan |
last post by:
Hi,
Sorry to repost, but this is becoming aggravating, and causing me a lot of
wasted time. I've got a reasonably large mixed C++ project, and after a
number of builds (but not a constant number) linking (and sometimes
compiling) becomes immensely slow, and task manager shows that link.exe (or
cl.exe) is barely using any processor time, but an awful lot of RAM (around
150-200MB). I'm going to keep an eye on page faults since I can't...
| |
by: Paul Hobbs |
last post by:
Hi All,
I am trying to replicate the functionality of the HTML FileField control. I can use it just fine to prompt a user to browse to a file, and it retrieves the full path just fine. I can then get the file path string by using control.value, and write it to the database. I don't want to actually do anything with the file. What I can't do is programmatically set the value of the FileField control - all the reading I have done says that...
|
by: Learning SQL Server |
last post by:
Forgive the repost, but this is really troublesome and I hope SOMEONE can
shed some light on it.
I am trying to update a datarow via in-place editing from a dataset stored
in session.
When I try to write the new value into the selected row, I always get the
following error : Column is read-only.
in my UpdateCommand event I have:
|
by: Scott M. |
last post by:
Can anyone give me any ideas on why VS.NET 2003 running on XP Pro. (P4's
with 1GB RAM) would take over 3 minutes to simply create a new ASP.NET Web
Application on http://localhost?
It seems that the IIS directory gets created right away, but it is not
configured as an application directory until several minutes go by.
Thanks,
Scott M.
|
by: Suzanne |
last post by:
Hi all,
I'm reposting this message as I'm experiencing this problem more and
more frequently :
I really hope someone out there can help me as I've been tearing my
hair out on this one for a good while and I'm getting really
frustrated now!
My problem is this - my custom controls periodically disappear from my
|
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...
|
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...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |