conversion of text file into data base file

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

Re: conversion of text file into data base file

 
0
  #11
Jan 4th, 2006
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: conversion of text file into data base file

 
0
  #12
Jan 4th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: conversion of text file into data base file

 
0
  #13
Jan 4th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

Re: conversion of text file into data base file

 
0
  #14
Jan 5th, 2006
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, 71 views)
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: conversion of text file into data base file

 
0
  #15
Jan 5th, 2006
jto,

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

Yomet
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

Re: conversion of text file into data base file

 
0
  #16
Jan 6th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: conversion of text file into data base file

 
0
  #17
Jan 6th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 51
Reputation: jto is an unknown quantity at this point 
Solved Threads: 0
jto jto is offline Offline
Junior Poster in Training

Re: conversion of text file into data base file

 
0
  #18
Jan 7th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 134
Reputation: Yomet is an unknown quantity at this point 
Solved Threads: 10
Yomet Yomet is offline Offline
Junior Poster

Re: conversion of text file into data base file

 
0
  #19
Jan 7th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 54
Reputation: royaloba is an unknown quantity at this point 
Solved Threads: 1
royaloba royaloba is offline Offline
Junior Poster in Training

Re: conversion of text file into data base file

 
0
  #20
Sep 12th, 2006
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..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC