Solved

how do i see the below data ?

Posted on 2000-03-07
15
152 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

773 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