can you help me with the second part of the app..How do you write an application to navigate the files created..in part a..which is the entire code below..It will display all data for one player at a time. There is a menu, to view first, next , previous, last, record..Also please include a search...to find..all records..according to team id..Arrays are not allowed in this app..Please help me..I really hope you can help me out with this..Also please include a find/search next option to find the next option where the target string can be found in the players name and the find next which will find the next matching record. note: all data remains on disk except the current record. Please help me!
this is the code...for the module:
Option Explicit
Type TeamRec
Team As String * 30
Division As String * 20
Conference As String * 20
End Type
Type PlayerRecordOne
IDNumber As Integer
Jersey As Integer
PlayerInfo1 As String * 20
Position As String * 2
PHeight As String * 5
PWeight As Integer
Birthdate As String * 10
YearsInLeague As Integer
BirthCity As String * 20
BirthCountry As String * 20
Team As String * 30
End Type
Type PlayerRecordTwo
Name As String * 25
Jersey As Integer
Position As String * 2
PHeight As String * 5
PWeight As Integer
Birthdate As String * 10
BirthCity As String * 20
BirthCountry As String * 20
TeamID As Integer
End Type
'Initialize the variables.
Sub Initialize(Team() As TeamRec, PlayerNumber As Integer, PlayerData() As PlayerRecordTwo, PlayerInfo1() As PlayerRecordOne, TeamData() As TeamRec)
Dim k As Integer
Dim MAX As Integer
For k = 1 To MAX
With PlayerInfo1(k)
.IDNumber = 0
.Jersey = 0
.PlayerInfo1 = ""
.Position = ""
.PHeight = ""
.PWeight = 0
.Birthdate = ""
.YearsInLeague = 0
.BirthCity = ""
.BirthCountry = ""
.Team = ""
End With
With Team(k)
.Team = ""
.Division = ""
.Conference = ""
End With
With TeamData(k)
.Team = ""
.Division = ""
.Conference = ""
End With
Next k
PlayerNumber = 0
End Sub
'Read file "Nhl2000.dat" into two arrays - "Player()" and "Team()".
Function ReadFile(Team() As TeamRec, PlayerInfo1() As PlayerRecordOne) As Integer
Dim Temp As Integer
Dim MAX As Integer
Dim k As Integer
Dim St As String
Dim msg As String
Dim answer As Integer
Dim ErrorFound As Boolean
Dim dtype As Integer
On Error GoTo ReadFileError
Temp = 0
k = 0
Open "A:\Nhl2000.dat" For Input As #1
Do While Not EOF(1)
k = k + 1
With Team(k)
.Team = PlayerInfo1(k).Team
Input #1, .Division
Input #1, .Conference
End With
Loop
Close #1
Temp = k
ReadFile = Temp
Exit Function
ReadFileError:
ErrorFound = True
msg = Error$(Err) & "!"
Select Case Err
Case 71
msg = msg & " Check disk and drive."
dtype = vbAbortRetryIgnore + vbCritical
answer = MsgBox(msg, dtype, "Error")
If answer = vbRetry Then
ErrorFound = False
Resume
End If
Case Else
msg = "Error # " & Err & ":" & msg
MsgBox msg, vbCritical, "Error"
End Select
Exit Function
End Function
'Find the number of unique team and read array "Team()" into different array "TeamData()".
Function UniqueTeam(Team() As TeamRec, TeamData() As TeamRec) As Integer
Dim k As Integer
Dim i As Integer
Dim j As Integer
Dim Temp As Boolean
Dim N As Integer
i = 1
TeamData(i) = Team(1)
j = i
For k = 2 To N
Temp = True
Do
If Team(k).Team <> TeamData(j).Team Then
Temp = False
Else
Temp = True
End If
j = j - 1
Loop Until j = 0 Or Temp = True
If Temp = False Then
i = i + 1
TeamData(i) = Team(k)
j = i
Else
j = i
End If
Next k
UniqueTeam = i
End Function
'Read array "Player()" into array "PlayerData".
Sub PlayerDataFile1(PlayerData() As PlayerRecordTwo, PlayerInfo1() As PlayerRecordOne, PlayerNumber As Integer, TeamData() As TeamRec, NumTeam As Integer)
Dim k As Integer
Dim i As Integer
For k = 1 To PlayerNumber
With PlayerData(k)
.Name = PlayerInfo1(k).PlayerInfo1
.Jersey = PlayerInfo1(k).Jersey
.Position = PlayerInfo1(k).Position
.PHeight = PlayerInfo1(k).PHeight
.PWeight = PlayerInfo1(k).PWeight
.Birthdate = PlayerInfo1(k).Birthdate
.BirthCity = PlayerInfo1(k).BirthCity
.BirthCountry = PlayerInfo1(k).BirthCountry
For i = 1 To NumTeam
If PlayerInfo1(k).Team = TeamData(i).Team Then
.TeamID = i
End If
Next i
End With
Next k
End Sub
'Use array "TeamData()" to create "TeamFile.Rec".
Sub TeamDataFile(TeamData() As TeamRec)
Dim Length As Integer
Dim k As Integer
Dim N As Integer