Actualy i got the attached Code from earlier disccusion
and its retriving security information from a .DAT file but the problem is the information data is not correct . i donno may be the the problem is (BINARY data and ASCII data type format) (how can i declare the deferent between tow types).
so please if you have better sample code (Visual Basic or VBA for Access) to retrive the correct data from (Interaday) .DAT files for your information the .DAT files it's not produced by MetaStock it's produced by another trading software but the same type of metastock because metastock can read it.
Anothe Solution if you can help ':-( how I can link to .DAT interaday) by VBA for Access Dbase.
Private Type myrec ' USER DATA TYPE
strName As String * 10
intNumbr As Integer
End Type
Private intPosition As Integer
Private Sub add_Click()
Dim rec As myrec
rec.strName = tname.Text ' Retrieves value from Textbox
rec.intNumbr = tnumber.Text
Open "c:\f2.dat" For Random As #1 Len = Len(rec)
MsgBox intPosition
Put #1, intPosition + 1, rec
Close #1
intPosition = intPosition + 1
tname.Text = ""
tnumber.Text = ""
End Sub
Private Sub Command1_Click()
Dim rec As myrec
Dim recnumber As Integer
recnumber = txtfindrecno
If (recnumber > 0) And (recnumber <= intPosition) Then
Open "c:\f2.dat" For Random As #1 Len = Len(rec)
Get #1, recnumber, rec
tname = rec.strName
tnumber = rec.intNumbr
Close #1
Else
MsgBox "invalid record number"
End If
End Sub
Private Sub Command2_Click()
Dim rec As myrec
Dim strRecname As String ' This is for what?
Dim fFound As Boolean
Dim intRecordnumber As Integer
intRecordnumber = 0
fFound = False
MsgBox txtfindrecname.Text
Open "c:\f1.dat" For Random As #1 Len = Len(rec)
Do While (Not EOF(1)) And (fFound = False)
intRecordnumber = intRecordnumber + 1
Get #1, intRecordnumber, rec
MsgBox rec.strName
MsgBox rec.intNumbr
MsgBox rec.strName
If CStr(rec.strName) = CStr(txtfindrecname.Text) Then
fFound = True
tnumber = rec.intNumbr
tname = rec.strName
End If
Loop
Close #1
If Not found Then
MsgBox "name " & txtfindrecname & " is not in file"
End If
End Sub
Private Sub Form_Load()
Dim rec As myrec
Open "c:\f1.dat" For Random As #1 Len = Len(rec)
intPosition = LOF(1) / Len(rec)
Close #1
End Sub
Private Sub recame_Change()
End Sub
Private Sub retrieve_Click()
Dim rec As myrec
Dim fFound As Boolean ' What is this for?
Dim strDatatodisplay As String
Dim intIndex As Integer
Open "c:\f1.dat" For Random As #1 Len = Len(rec)
For intIndex = 1 To intPosition
Get #1, , rec
tname.Text = rec.strName
tnumber.Text = rec.intNumbr
strDatatodisplay = rec.Name & " " & rec.intNumbr
List1.AddItem strDatatodisplay
Next intIndex
Close #1
End Sub
Private Sub n_Click()
End Sub