Post by DARKNIGHT on Feb 1, 2024 3:08:38 GMT -5
Hello Guys,
well, its getting there, but I added 2 more fields to the Field statement, Also added string vals to Each record for the two new entries,
but now if I try to re-write the records, I get a brief flash on the screen, and the program Halts, and does nothing more
{Note) UN-Rem line 10, this creates the files. once this is done, Re-Rem line 10, And run the program to see the Data in Roster form. I remed out the two troublesome Field entries. also you must change the total Len to 122 when you Un-Rem these two field statements... Any help will be appreciated. thanks in Advance
Here is my code
Rem ---------------------------------
Rem | Random Access Roster test |
Rem ---------------------------------
Rem [NOTE] '*** un-rem line 10 first, to Create Records,then re-rem it and run program ***
OPEN "members2.dat" FOR RANDOM AS #1 LEN= 76 ' Set LEN to 122 W/ Phone and Email / 76 W/o
FIELD #1,_' set up the fields for file opened as #1
30 AS Name$,_ ' Name$ , string
40 AS Address$,_ ' Address$, string
6 AS IDnumber ' IDnumber, numeric
'16 AS Phone$,_ ' Phone #, String * - | Rem'ed out because of Errors
'30 AS Email$,_ ' Email , String * - |
'*** Un-Rem this line to create Files ***
' 10 gosub [Set_Data] '
[Draw_Form]
let a=1:let b=10
locate 8,6:print"[ MEMBER LIST ]"
locate 5,7:print"========================================"
locate 5,8:print"| ENT # | NAME: | ID #: |"
locate 5,9:print"========================================"
[Fetch_Recs]
if (a * 76) > lof(#1) then gosub [select]
GET #1,a
[Fill_Roster]
locate 8,b:print a
locate 15,b:print Name$'
locate 38,b:print IDnumber
let a=a+1:let b=b+1
gosub [Fetch_Recs]
[select]
locate 5,b+1:print"========================================"
locate 5,b+2:input" TYPE ENT # TO VIEW DETAILS ->:";ent
if ent=0 or ent > a-1 then locate 36,b+2:print" ":gosub [select]
gosub [Fetch_Rec]
[Set_Data]' *** CREATES RECORDS- on first time use ***
for a=1 to 3
if a=1 then let Name$ = "Public, John, Q.": Address$ = "456 Maple Street, Anytown, USA":IDnumber = 9274':Phone$="(482)-160-8721":Email$="johnQP@Yahoo.com"
if a=2 then let Name$ = "Jones, Alfred, R.":Address$ = "227 15th Av, New York New York, USA":IDnumber = 4365':Phone$="(218)-521-1276":Email$="AlfJones@Gamil.com"
if a=3 then let Name$ = "Smith, Robert, T.":Address$ = "952 Bridge St, Burlington VT, USA":IDnumber = 1028':Phone$="(701)-882-7174":Email$="RobSmith@Aol.com"
PUT #1,a
next a
print"Records Written"
close #1
end
[Add_Record]
let Name$ = "Allerman, Jake,R ":Address$ = "447 Sapulvita Blvd, Los Angelas Ca, USA":IDnumber =9345:Phone$="(222)-480-9245":Email$="jWilks@Yahoo.com"
PUT #1,4
print" New Record Added "
close #1
end
[Fetch_Rec]
cls
locate 8,6:print"[ MEMBER LIST ]"
locate 5,7:print"==========================================================="
locate 5,8:print"| NAME: | ID #: |"
locate 5,9:print"==========================================================="
locate 5,11:print"=========================================================="
locate 5,12:print"| ADDRESS: |"
locate 5,13:print"=========================================================="
locate 8,15:print" [ CONTACT INFO ]"
locate 5,16:print"=========================================================="
locate 5,17:print"| PHONE: EMAIL: |"
locate 5,18:print"=========================================================="
Get #1, ent
locate 14,8:print Name$
locate 54,8:print IDnumber
locate 17,12:print Address$
locate 15,17:print Phone$
locate 38,17:print Email$
locate 7,21:input"Press 'Enter' to return to Roster -> ";rt$
cls
gosub [Draw_Form]