Hello again,
Believe me, I tried several searchs and couldn't find a thread related to my question :).
I have a form that incorporates fields that will have changes made. I have put this script in the 'Can Save Record' event in field rules for records.
'-------------------------------------------------------
'This script checks each record after changes for errors
'-------------------------------------------------------
DIM TEST_YEAR AS N
ON ERROR GOTO check
dbh = db_current()
If db_mode_get(dbh) = 1 .and. pap_rslt-"path_date "" {} then
If year(date()) = year(pap_rslt-"date_acc) then
test_year = year(date())
Else if year(date()-1) = year(pap_rslt-"date_acc) then
test_year = year(date()-1)
End if
If year(pap_rslt-"path_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Pathologist.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
fetch_prev(dbh) ---------------------
card_resynch() ---------------------
A_CAN_DO = "F" --------------------- Lines of concern!
End
End if
Select
Case pap_rslt-"cyt1_date "" {}
If year(pap_rslt-"cyt1_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#1.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
Case pap_rslt-"cyt2_date "" {}
If year(pap_rslt-"cyt2_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#2.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
Case pap_rslt-"cyt3_date "" {}
If year(pap_rslt-"cyt3_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#3.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
End Select
End if
End
Check:
err = error_code_get()
msg = error_text_get(err)
ui_msg_box("Error", msg)
RESUME NEXT
It works as far as not saving the any of the data, but after encountering the A_Can_Do = "F" , it will not remain on the same record? Is there any way I can get it to stay with the original record for corrections? As you can see, I have tried fetching, but that doesn't seem to work? The script is attached to the Path_date field in the field rules.
Any help appreciated - Thanks in advance :)
Mac
Believe me, I tried several searchs and couldn't find a thread related to my question :).
I have a form that incorporates fields that will have changes made. I have put this script in the 'Can Save Record' event in field rules for records.
'-------------------------------------------------------
'This script checks each record after changes for errors
'-------------------------------------------------------
DIM TEST_YEAR AS N
ON ERROR GOTO check
dbh = db_current()
If db_mode_get(dbh) = 1 .and. pap_rslt-"path_date "" {} then
If year(date()) = year(pap_rslt-"date_acc) then
test_year = year(date())
Else if year(date()-1) = year(pap_rslt-"date_acc) then
test_year = year(date()-1)
End if
If year(pap_rslt-"path_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Pathologist.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
fetch_prev(dbh) ---------------------
card_resynch() ---------------------
A_CAN_DO = "F" --------------------- Lines of concern!
End
End if
Select
Case pap_rslt-"cyt1_date "" {}
If year(pap_rslt-"cyt1_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#1.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
Case pap_rslt-"cyt2_date "" {}
If year(pap_rslt-"cyt2_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#2.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
Case pap_rslt-"cyt3_date "" {}
If year(pap_rslt-"cyt3_date) "" test_year then
ui_msg_box("ATTENTION!!!","You have entered an invalid date for Cytologist#3.",16)
ui_msg_box("EDIT PLEASE!","Please correct changes before saving record! Thank You!",64)
End if
End Select
End if
End
Check:
err = error_code_get()
msg = error_text_get(err)
ui_msg_box("Error", msg)
RESUME NEXT
It works as far as not saving the any of the data, but after encountering the A_Can_Do = "F" , it will not remain on the same record? Is there any way I can get it to stay with the original record for corrections? As you can see, I have tried fetching, but that doesn't seem to work? The script is attached to the Path_date field in the field rules.
Any help appreciated - Thanks in advance :)
Mac
Comment