Poll: is this question stupid? (hint: click yes!)
You do not have permission to vote in this poll.
yes
100.00%
11 100.00%
Total 11 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error meesages
#11
Quote:ok, i used the code you suggested and now it creates the new file! :rotfl:

however, a new problem has popped up. it creates the file, then it opens the file and for some reason it goes to the errorhandler and freezes there.

here is the sub where the problem occurs:
Code:
SUB SELECTSTUDENT
'THIS SUB WILL PROMPT THE USER FOR THE STUDENTS NAME, WHICH DOUBLES AS A FILE NAME IN WHICH THE DATA IS STORED

ON ERROR GOTO ERRORHANDLER

PRINT "PLEASE ENTER THE STUDENTS NAME"
INPUT N$
OPEN (N$) + ".SDN" FOR INPUT AS #1
STUDENTINFO

END SUB

i also modified the error handler to comply with my requirements:
Code:
ERRORHANDLER:
SELECT CASE ERR
CASE 53
PRINT "File not found."
PRINT "Creating file:"; N$
OPEN N$ + ".SDN" FOR OUTPUT AS #1
CLOSE #1
SELECTSTUDENT
CASE 64
PRINT "The file name you entered was incorrect."
CASE 76
PRINT "Path not found."
END SELECT
RESUME
i am really lost and so any help is apreciated! :???:

I think you're having some problems with the scope the N$ variable. Look: the errortrap must be in the main module, while the error occured in a sub, with a variable N$, in the main module there is no N$. I think you could solve this problem with:

Code:
SUB SELECTSTUDENT
'THIS SUB WILL PROMPT THE USER FOR THE STUDENTS NAME, WHICH DOUBLES AS A FILE NAME IN WHICH THE DATA IS STORED

ON ERROR GOTO ERRORHANDLER

PRINT "PLEASE ENTER THE STUDENTS NAME"
INPUT N$
OPEN (N$) + ".SDN" FOR INPUT AS #1
STUDENTINFO

END SUB

Main Module:
Code:
'$DYNAMIC
DEFINT A-Z
DIM SHARED N$

CALL SELECTSTUDENT

ERRORHANDLER:
SELECT CASE ERR
CASE 53
PRINT "File not found."
PRINT "Creating file:"; N$
OPEN N$ + ".SDN" FOR OUTPUT AS #1
CLOSE #1
SELECTSTUDENT
CASE 64
PRINT "The file name you entered was incorrect."
CASE 76
PRINT "Path not found."
END SELECT
RESUME
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)