I have this code to open a text file for Input.

Dim intFileNum As Integer, strName As String
Dim strFilter As String, NumberCorrect As Integer
Dim intNumberOfQuestions As Integer
Dim intLoadQuestions As Integer
Dim intLoadFields As Integer
Dim strTestName As String
Const conTitle As String = "Your Name"
Const conPrompt As String = "Enter your name:"



'frmQuizzerSplash.Show vbModal

strName = InputBox(conPrompt, conTitle)

intFileNum = FreeFile
strFilter = "Text Files (*.txt)|*.txt|" & "All files (*.*)|*.*"
cdlOpenfile.Filter = strFilter
cdlOpenfile.ShowOpen
g_strFileName = cdlOpenfile.FileName
'On Error GoTo FileOpenErr
Open g_strFileName For Input As #intFileNum

When I hit cancel on the Dialog box I get this error: Path/File Access Error

And it highlights this line: Open g_strFileName For Input As #intFileNum

Is there some more code I should have to make the dialog box just cancel?