02-18-2023, 09:39 AM
Could you not just keep all the data in comma delimited strings, and then just split them as you need them
that way there is no limit to the length of the strings and you can just add data to the end of the string giving unlimited results storage
that way there is no limit to the length of the strings and you can just add data to the end of the string giving unlimited results storage
Code: (Select All)
ReDim sData(0) as string
open "StudentData.csv" for input as #1
do
line input #1, sData(ubound(sData))
ReDim _Preserve sData(Ubound(sData)+1)
loop until eof(1)
input "Enter name or id to search for> ",s$
for i = 1 to ubound(sData)
if instr(sData(i),s$) > 0 then print sData(i)
next
Sub Str2arr (ST As String, AR() As String, DL As String)
Dim Delim(Len(DL)) As String
For i = 1 To Len(DL)
Delim(i) = Mid$(DL, i, 1)
Next
'find first delim
c = 1
Do
For i = 1 To UBound(Delim)
If Mid$(ST, c, 1) = Delim(i) Then
ReDim _Preserve AR(UBound(AR) + 1)
c = c + 1
Exit For
End If
Next i
AR(UBound(AR)) = AR(UBound(AR)) + Mid$(ST, c, 1)
c = c + 1
Loop Until c > Len(ST)
End Sub