All
I have a combobox which shows some files from a specific folder. Furthermore I have a button "cmdLoadPreset" to open the file currently chosen in the combobox. The code inside "cmdLoadPreset" calls another sub LoadPreset with the filename as parameter. This code does work as the content of the file is shown in Me.txtDetail.
Furthermore I have a seperate button which deletes the file which is chosen in the combobox. I use next statement in that specific sub.
The Kill-command only works when I did not open the file yet. If I first load the file and I try to delete it afterwards, I get "Run-time error 55: File already open" although the LoadPreset-sub does have the line "Close #intFileNum"
What's going wrong?
Regards
Ino
I have a combobox which shows some files from a specific folder. Furthermore I have a button "cmdLoadPreset" to open the file currently chosen in the combobox. The code inside "cmdLoadPreset" calls another sub LoadPreset with the filename as parameter. This code does work as the content of the file is shown in Me.txtDetail.
Code:
Private Sub LoadPreset(Optional strFile As String)
Dim intFileNum As Integer
Dim strData As Variant
intFileNum = FreeFile
Open strFile For Binary Access Read As intFileNum
Me.txtDetail=""
Do While Not EOF(intFileNum)
Get intFileNum, , strData
Me.txtDetail = Me.txtDetail & strData
Loop
Close #intFileNum
End Sub
Furthermore I have a seperate button which deletes the file which is chosen in the combobox. I use next statement in that specific sub.
Code:
Kill strPresetsPath & "\" & Me.cboPresets.Value & ".avdp"
The Kill-command only works when I did not open the file yet. If I first load the file and I try to delete it afterwards, I get "Run-time error 55: File already open" although the LoadPreset-sub does have the line "Close #intFileNum"
What's going wrong?
Regards
Ino