If file doesnt exist its suppose to capture the error but its not! Can ya see whats wrong?
'Load The Sequential File Combo Box
Dim intFileNumber As Integer
intFileNumber = FreeFile 'Get next available file number
'Load UnCharged Rooms
frmMain.cboRooms(0).Clear 'Clear List Before Loading
Open App.Path & "\UnchargedRooms.Dat" For Input As #intFileNumber 'open file
Do Until EOF(intFileNumber) 'Do until end of file
Input #intFileNumber, strReadRecord 'Put line in string
frmMain.cboRooms(0).AddItem strReadRecord 'add string to box
Loop 'go to next string
Close #intFileNumber 'Close File
HandleErrors: 'Error-Handling routine
Select Case Err.Number 'Select Error
Case 53 'File Not Found
MsgBox "One Of The Dat Files Is Missing, Program Will Now Terminate.", vbCritical, "Loading Validation" 'Give Message
Unload Me 'Clear Me From Memory
End 'Exit Project If File Doesnt Exist
End Select




Reply With Quote