April 16th, 2013, 04:39 PM
[RESOLVED] Visual basic 6 - Next without for
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,
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
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
Name newfilename As products
MsgBox ("You must select a product first")
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.