-
October 8th, 2012, 08:13 AM
#16
Re: Run-time Error 52 Bad filename or number
have the same problem with the following piece of code help plz i have over 1000 lines code working already aand really need this bit to work but cant work it out :
Code:
frm_winnings.lblnumbers_matched = ("you have matched " & result & "numbers")
Select Case result
Case result < 3
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #1
winnings(1) = Input(LOF(6), 1)
Close #1
Case result = 3
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #2
winnings(2) = Input(LOF(6), 2)
Close #2
Case result = 4
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #3
winnings(3) = Input(LOF(6), 3)
Close #3
Case result = 5
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #4
winnings(4) = Input(LOF(6), 4)
Close #4
Case result = 6
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #5
winnings(5) = Input(LOF(6), 5)
Close #5
Case result = 7
Open "N:\Computing\Advanced Higher Computing\Software Development\winnings.txt" For Input As #6
winnings(6) = Input(LOF(6), 6)
Close #6
End Select
End Sub
-
October 8th, 2012, 02:17 PM
#17
Re: Run-time Error 52 Bad filename or number
You should use the same file number in the LOF function
Code:
'
winnings(1) = Input(LOF(1), 1)
'
winnings(2) = Input(LOF(2), 2)
'
'etc
The LOF function retrieves the size of the file you want to load
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|