Can't get code from bbc basic working

100 Views Asked by At
  440 DEFPROCsave
  450 phonenos=OPENUP("Phonenos")
  470 PRINT
  480 FOR j= 1 TO counter
  490       PRINT#phonenos,contact{(j)}.name$,contact{(j)}.phone$,contact{(j)}.email$
  500   FOR f = 1 TO 10
  510     PRINT#phonenos,contact{(j)}.response%(1,f)
  520   NEXT f
  530   
  540 NEXT j
  550 CLOSE#phonenos
  560 PRINT "Data saved."
  570 ENDPROC

Code to save details from database I'm trying to save what i have entered to a file but the error INVALID CHANNEL AT LINE 490 APPEARS/

1

There are 1 best solutions below

2
On

If your error is on line 490, one of two things is likely happening.

  1. Your FILEHANDLE for phonenos did not open.

    You could be attempting to access the file from a bad location, it may not exist, or it could be write protected.

  2. Your contact array is referencing an invalid index item.

    Is counter going outside the range of the array? Is this a zero (0) or one (1) based array?