I have a button on a form that is suppose to add a record to the child table of the set used to build the form.
The first part of the code, which i have omitted, displays a dialog box that prompts for a name. It saves the name to variable prompt_var_2
The next part of the code is listed below.
Things will work fine...and then tragedy strikes:(
For some reason, when it gets to tbl.enter_end(.t.) it gives me a "read past end of file" error.
When this error starts happening, I have tried running the code below in the interactive window with the form open, with the form closed, (when i fire the button) etc and i get the error every time.
I have another form with a button that rebuilds the indexes of the tables of this form (and other forms to boot)
If I rebuild the indexes, it will once again work...for a while.
I am not for sure why this problem occurs. Any suggestions would be useful.
I am also not for sure if i have given adequate info. Please let me know if you need more.
Thanks
Tony
Just in case, I have included the complete code from the button push below:
[/CODE]
The first part of the code, which i have omitted, displays a dialog box that prompts for a name. It saves the name to variable prompt_var_2
The next part of the code is listed below.
Things will work fine...and then tragedy strikes:(
For some reason, when it gets to tbl.enter_end(.t.) it gives me a "read past end of file" error.
Code:
dim tbl as p tbl = table.open("cyc_data") tbl.enter_begin(.t.) tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables()) tbl.SET_NAME = prompt_var_2 tbl.enter_end(.t.) tbl.close()
I have another form with a button that rebuilds the indexes of the tables of this form (and other forms to boot)
If I rebuild the indexes, it will once again work...for a while.
I am not for sure why this problem occurs. Any suggestions would be useful.
I am also not for sure if i have given adequate info. Please let me know if you need more.
Thanks
Tony
Just in case, I have included the complete code from the button push below:
Code:
'Use an Xdialog box to prompt for field values..... dim flag_ok_selected as l flag_ok_selected = .f. ' DIM Prompt_var_2 as C DIM ui_get_parameters_result as C Prompt_var_2 = "" ok_button_label = "&OK" cancel_button_label = "&Cancel" ui_get_parameters_result = ui_dlg_box("Enter Subcycle Name",<<%dlg% {region} Set Name:| [.40Prompt_var_2]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%,<<%code% if a_dlg_button = "ok" then flag_ok_selected = .t. end if %code%) if ui_get_parameters_result <> "OK" then end end if dim tbl as p tbl = table.open("cyc_data") tbl.enter_begin(.t.) tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables()) tbl.SET_NAME = prompt_var_2 tbl.enter_end(.t.) tbl.close() 'Refresh 'Cycle_list' in current form. topparent:Data_list.refresh() topparent:Data_list.fetch_last() I have [CODE]dim tbl as p tbl = table.open("cyc_data") tbl.enter_begin(.t.) tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables()) tbl.SET_NAME = prompt_var_2 tbl.enter_end(.t.) ERROR: Read past end of file tbl.close()
Comment