Hey, this is my first post. Currently completing A2 ICT and we have a brief to code a program to allow a school worker the ability to monitor the loaning of equipment. Got an array so i can add data etc...however i need to be able to add/delete. Add works fine, the delete option keepings coming up with "next without for"?

Heres the code,

Code:
 Private Sub cmddelete_Click()
Dim index As Integer
Dim numberofrecords As Integer
Dim recordnumbertodelete As Integer
Dim newfilename As String
Dim product As OneProduct
If lstdisplayfile.Text <> "" Then
recordnumbertodelete = lstdisplayfile.ListIndex + 1
End If
newfilename = App.Path & "\products.text"
Open Filename For Random As #1 Len = Len(product)
Open newfilename For Random As #2 Len = Len(product)
numberofrecords = LOF(1) / Len(product)

    Get #1, , product
    If index <> recordnumbetodelete Then
    
    Put #2, , product
    End If
    
Next index

Close #1
Close #2
Kill products
Name newfilename As products
Call displayfile
Else
MsgBox ("You must select a product first")
End If


End Sub
Cheers,

Jordie