|
-
Feb 12th, 2004, 05:16 PM
#1
Thread Starter
Lively Member
vb problem
i create a random file and i access the random file very fast,but i
want to create another random file but the large of the record,or the key is 9 of length , but i do not know how can access a record
Private Type records
cinta As String * 6
fe As String * 8
sc As String * 8
su As String * 3
ye As String * 2
descripcion As String * 30
nuci As String * 1
ar As String * 1
se As String * 6
last As String * 8
End Type
Private Sub Command1_Click()
'Programa Crea Archivo Random
Dim myrec As records, W
Dim P As Integer
Open "c:\qbasic\biblio3.txt" For Input As #1
rtn1:
If EOF(1) Then GoTo pre
Line Input #1, c$
Let P = P + 1
GoTo rtn1
pre:
Print x
Close #1
ProgressBar1.Max = P
Open "c:\qbasic\biblio3.txt" For Input As #1
Open "c:\qbasic\Master_Random.txt" For Random As #2 Len = Len(myrec)
Open "c:\qbasic\cinta.txt" For Output As #4
lee:
For W = 1 To P
ProgressBar1.Value = W
Input #1, cin$, fech$, scra$, subs$, yy$, descr$, numcin$, area$, see$, lasttrx$
myrec.cinta = cin$
myrec.fe = fech$
myrec.sc = scra$
myrec.su = subs$
myrec.ye = yy$
myrec.descripcion = descr$
myrec.nuci = numcin$
myrec.ar = area$
myrec.se = see$
myrec.last = lasttrx$
Put #2, cin$, myrec
Next W
fin:
Print #4, myrec.cinta
Print
Print
Print
Print "ULTIMO NUMERO DE CINTA PROCESADO -----> " & myrec.cinta
Print "RECORDS PROCESADOS ---------------------------------> " & W
Close #1
Close #2
Close #4
*************access the file*******************
Private Type records
cinta As String * 6
fe As String * 8
sc As String * 8
su As String * 3
ye As String * 2
descripcion As String * 30
nuci As String * 1
ar As String * 1
se As String * 6
last As String * 8
End Type
Private Sub Command1_Click()
Open "c:\qbasic\cinta.txt" For Input As #3
Input #3, valor
Close #3
If numero = "" Then
MsgBox "TIENES QUE ENTRAR NUMERO DE CINTA"
numero.SetFocus
Command1.Enabled = True
Exit Sub
Else
End If
Command1.Enabled = False
Dim myrec As records, x
Dim con As String
Open "c:\qbasic\Master_Random.txt" For Random As #2 Len = Len(myrec)
rtn2:
Let x = numero
If x > 4992 And x < 10000 Then
Print "Record no Existe"
Exit Sub
End If
If x < 1 Or x > valor Then
Print "Record no Existe"
Else
Get #2, x, myrec
FontBold = True
Let con = Chr$(47)
Let mes = Mid$(myrec.fe, 1, 2)
Let dia = Mid$(myrec.fe, 3, 2)
Let yea = Mid$(myrec.fe, 5, 4)
Let temfe = mes + con + dia + con + yea
Print myrec.cinta & " " & temfe & " " & myrec.sc & " " & myrec.descripcion
Command3.SetFocus
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|