943,861 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jan 4th, 2006
0

Re: conversion of text file into data base file

yomet
when i am adding the code as u suggest i.e data(0)=Mid(InLine, 1, 10) and so on
but i am getting subscript out of range why?
jto
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
jto is offline Offline
51 posts
since Oct 2005
Jan 4th, 2006
0

Re: conversion of text file into data base file

Did you change the INSERT INTO statement to take into account the existing fields? I.e. you can no longer use Data(16), Data(17), Data(18) and Data(25) but need to adjust these subscripts, as well as the others, to reflect the existing members of the Data() array.

Also, I noticed an error on my part, I put the AMT_DUE and NAME on the same line. I have updated the definition and also added the corresponding Data() index. The data definition should be as follows:
Array pos Field Start Len
===========================================
Data(0) ACCOUNT_NO 1 10
Data(1) MOBILE_NO 11 10
Data(2) BILL_REF_NO 23 11
Data(3) OTC 35 10
Data(4) RC 46 10
Data(5) USAGE 57 10
Data(6) MISC 68 10
Data(7) ADJ 79 10
Data(8) DISC 90 10
Data(9) ST 101 10
Data(10) BILLED_AMT 112 10
Data(11) LATE_FEE 123 10
Data(12) PAYMENT 134 10
Data(13) PREV_BAL 145 10
Data(14) AMT_DUE 156 10
Data(15) NAME 167 30

Hope this helps

Yomet
Reputation Points: 16
Solved Threads: 10
Junior Poster
Yomet is offline Offline
134 posts
since Nov 2005
Jan 4th, 2006
0

Re: conversion of text file into data base file

One more thing, if it still bugs out, please send you new code and tell me which line is giving you the error. You can find that out by selecting "Debug" when the program crashes. The line in question will be highlighted in yellow.

Thx

Yomet
Reputation Points: 16
Solved Threads: 10
Junior Poster
Yomet is offline Offline
134 posts
since Nov 2005
Jan 5th, 2006
0

Re: conversion of text file into data base file

yomet ,
again we r getting the same problem script out of range in the line Data(0) = Mid(InLine, 1, 10) it showing that 'script out of range ' when i am taking the cursor on Data(0) in debug mode .I am sending the new code as attachment
Attached Files
File Type: zip TextToDB_new2.zip (137.1 KB, 91 views)
jto
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
jto is offline Offline
51 posts
since Oct 2005
Jan 5th, 2006
0

Re: conversion of text file into data base file

jto,

I found the problem:
Dim Data() As String
You will have to
Dim Data(15) As String
for this to work...

Yomet
Reputation Points: 16
Solved Threads: 10
Junior Poster
Yomet is offline Offline
134 posts
since Nov 2005
Jan 6th, 2006
0

Re: conversion of text file into data base file

hello yomet
thank u ,from this code is working perfectly . but if text file having any header information it is also updating in data base .can we apply a condition that if data(0)='Account_no" or "-----" skip that line .
pls suggest me the condition code.
jto
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
jto is offline Offline
51 posts
since Oct 2005
Jan 6th, 2006
0

Re: conversion of text file into data base file

jto,

You are absolutely correct in your assessement of the situation and if you look at posting #10 you will see that I already told you this, not to confuse with "told you so"...

You already have the code in your posting, it's a simple IF statement that you put around the
db.Execute "INSERT INTO Table1 (Acco[...]
statement.

You should be able to figure out the exact syntax of a simple If statement, otherwise you woudn't have gotten this far...

Happy coding

Yomet

P.S. By using this approach you do not need to skip the first lines of the data file since this condition will automatically eliminate the header from the beginning of the file.
Reputation Points: 16
Solved Threads: 10
Junior Poster
Yomet is offline Offline
134 posts
since Nov 2005
Jan 7th, 2006
0

Re: conversion of text file into data base file

Yomet ,
one thing more i want to take the required database report in a particular format , can we use crystal report . i heard that it is very good report genration tool . can u help me . if not can we take the report from vb also.
jto
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
jto is offline Offline
51 posts
since Oct 2005
Jan 7th, 2006
0

Re: conversion of text file into data base file

jto,

I cannot help you with Crystal Reports since I do not have enough experience with that but if your client(s) have Access installed you can take all the code from VB, with slight modifications, and add it to an Access databse and use the reporting tool from Access to create your reports. This still works if you will be using another database than Access as the real backend since you can use Access as the frontend instead of VB.

Otherwise I am sure there are knowledgable Crystal Reports people in this forum.

Hope this helps

Yomet
Reputation Points: 16
Solved Threads: 10
Junior Poster
Yomet is offline Offline
134 posts
since Nov 2005
Sep 12th, 2006
0

Re: conversion of text file into data base file

hello sir jomet

2005/11/11 17:36:13, Event:Access, Door:entry, Card No.:1234, Description:333
2005/11/11 17:36:17, Event:Access, Door:entry, Card No.:1234, Description:333
2005/11/11 17:36:20, Event:Access, Door:entry, Card No.:2222, Description:222
2005/11/11 17:36:26, Event:Access, Door:entry, Card No.:2222, Description:222

i when i read this thread, i got my problem solve on how to save the text file in database.. i have a project which time and attendance base on textlog.. my problem is how can i save the time in two TIME IN and TIME OUT the first record is for the time in and the last record willbe for the time out, base on their card number and date..
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
royaloba is offline Offline
54 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: form load
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: HELP!Populate Datagrid using ORACLE table





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC