Solved

how do i see the below data ?

Posted on 2000-03-07
15
153 Views
Last Modified: 2010-05-02
i has 1 file which inside it like the below.

01012000  john032 male  02012000  richard45 female  03012000  samy060  male


above is contains 3 data .the first data is from "01012000 john032  to male   and the second data starting from "02012000 richard45 to female"

the problem is if im using my own code it just can display  me the first data only and the second plus third wont show. so whats the code to give me away that i can display the second data after the first data.



pls
0
Comment
Question by:JOHNHO
  • 8
  • 4
  • 2
  • +1
15 Comments
 
LVL 9

Expert Comment

by:samopal
ID: 2592096
How do you want to display data?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2592112
Something like this:

Private Sub Command1_Click()
Dim intI As Integer
Dim str1 As String
Dim str2 As String
Dim varX As Variant


    str1 = "01012000  john032 male  02012000  richard45 female  03012000  samy060  male"
    str1 = Replace(str1, "  ", " ")
    varX = Split(str1, " ")
    For intI = LBound(varX) To UBound(varX)
        If (intI Mod 3) = 0 Then
            Debug.Print str2
            str2 = ""
        End If
        str2 = str2 & varX(intI) & ";"
    Next
    Debug.Print str2
End Sub
0
 

Author Comment

by:JOHNHO
ID: 2592157
like this,

the below is the real situation. the real file is like the below

17269  2407199600000002400119623700000010000000001000 13166  2407199600000019600686253600000010000000001000 13166  2407199600000019700686253600000010000000001000 13166  2407199600000019800686253600000030000000003000 13166  2407199600000020100686253600000050000000005000 007500100000000000500000000000365738601081996        

and my code for viewing the above record is as below


Public Sub FILLFORM(STRDATA)
Text1 = Trim(Mid(STRDATA, 1, 1))
Text2 = Trim(Mid(STRDATA, 2, 6))
Text3 = Trim(Mid(STRDATA, 8, 8))
Text4 = Trim(Mid(STRDATA, 16, 9))
Text5 = Trim(Mid(STRDATA, 25, 9))
Text6 = Trim(Mid(STRDATA, 34, 10))
Text7 = Trim(Mid(STRDATA, 44, 10))
Text8 = Trim(Mid(STRDATA, 54, 54))
End Sub

Dim CommandString As String
Dim STRDATA As String
Do
Line Input #1, STRDATA
Call FILLFORM(STRDATA)
DoEvents
Debug.Print STRDATA
Loop Until EOF(1)
Call closerfile

but the results is i just can get the first record only and the following record wont be show.


help me pls.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:JOHNHO
ID: 2592178
plus

i think this is the delimited type of file.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2592266
After outputting your line to the Immediate Window (with Debug.Print), what do you see? If you only see one line this is because you don't have a Carriage-Return-LineFeed character in your file.

Also, how did you code your Open statement?

0
 

Author Comment

by:JOHNHO
ID: 2592267
or u can continue my code.

how do i ask it to show the second record after the first record.

i hope u all understand it.
0
 

Author Comment

by:JOHNHO
ID: 2592311
my open statement is as below,

Open "a:\cft001.txt" For Input As #1

and in the imme win i only can see 1 line of record only.

so what to do ?
0
 

Author Comment

by:JOHNHO
ID: 2592353
plus

all the data that i just post before this is all in 1 line. i mean all the data inside 1 line and we need  to separeted it 1 by 1.  


in in immed win i can see 1 line data but it contains 2 record. but i need to separated it to become 2 record, how ?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2592359
«and in the imme win i only can see 1 line of record only. »
Is this line contains all your file?

Also, with this code, you are supposed to see only the last line because you always overwrite the contents of text boxes.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2592365
«in in immed win i can see 1 line data but it contains 2 record. but i need to separated it to become 2 record, how ?»
Did you create this file? Show us the code you use for this.
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 100 total points
ID: 2593444
I think I understand what you're asking.  You have a data file 'cft001.txt' that contains a continuous stream of data.  This data has multiple records.

If all of the records in the file are the same length, then you can change your code to read the data in like this:

-------------

You would open the file like this:

Open "a:\cft001.txt" For Binary Access Read As #1

-------------------
and your routine would be modified like this:

Public Sub FILLFORM(STRDATA)
Text1 = Trim(Mid(STRDATA, 1, 1))
Text2 = Trim(Mid(STRDATA, 2, 6))
Text3 = Trim(Mid(STRDATA, 8, 8))
Text4 = Trim(Mid(STRDATA, 16, 9))
Text5 = Trim(Mid(STRDATA, 25, 9))
Text6 = Trim(Mid(STRDATA, 34, 10))
Text7 = Trim(Mid(STRDATA, 44, 10))
Text8 = Trim(Mid(STRDATA, 54, 54))
End Sub

Dim CommandString As String
Dim STRDATA As String
Const RecordLength=108 ' using above
                       'breakout as
                       'actual record
                       'length

STRDATA = Input(RecordLength, #1)

Do While Not EOF(1)
  Call FILLFORM(STRDATA)
  DoEvents
  Debug.Print STRDATA
  STRDATA = Input(RecordLength, #1)
Loop
Call closerfile
0
 

Author Comment

by:JOHNHO
ID: 2595226
fail ,

to bhess1.

it show me that "bad file name or number".

for your information, the record lenght for 1 record is 54 character. the second record will be the next number.

so how do i do it ?

for more clear here is the data that contains 2 record in 1 line. so pls do it for me.



18842  2802200000000168700130283500000010000000001000 14545W 2802200000000076600525030300000010000000000400 007500100000000000200000000000055454003032000        


0
 

Author Comment

by:JOHNHO
ID: 2595288
fail ,

to bhess1.

it show me that "bad file name or number".

for your information, the record lenght for 1 record is 54 character. the second record will be the next number.

so how do i do it ?

for more clear here is the data that contains 2 record in 1 line. so pls do it for me.



18842  2802200000000168700130283500000010000000001000 14545W 2802200000000076600525030300000010000000000400 007500100000000000200000000000055454003032000        


0
 

Author Comment

by:JOHNHO
ID: 2595291
YES I CAN DO IT !!!




SORRY BHESS1.
THANKS FOR HELPING ME.

0
 
LVL 32

Expert Comment

by:bhess1
ID: 2596435
No problem - glad to help
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 38
VB6 - Convert HH:MM into Decimal 8 62
VB6 ListBox Question 4 48
Export PDF Form fields to Access  or Excel  in Tab order 16 80
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question