I have an application that 24 people in our organization use. In order to keep it as simple as possible, I used Dr. Wayne's script on his Learnalpha site to turn off modeless entry. I also have all the toolbars disabled.
I put a button on the form (like Dr. Wayne said) that allows entry. That also works fine. I also needed the button to bring up a new record, so I now have a button that does both things. However, it also forces the current record to be saved if it is pushed again during entry.
My problem is that I need to disable the button until the current record is cancelled or saved so that people don't inadvertently save a record before they are ready since I don't allow them to change a record.
This is the script that I have on the button:
''XBasic
parent.restrict_enter=.f.
DIM ax_choice as C
DIM ax_response as N
DIM ax_dialog as P
ON ERROR GOTO ax_error_trap
DIM ax_error_trap_desc as C
DIM ax_error_trap_offset as C
DIM ax_error_trap_msg as C
DIM ax_error_trap_response as N
ax_error_trap_desc = "Action Script"
ax_error_trap_offset = "0"
ax_error_trap_desc = "New Record"
ax_error_trap_offset = "1"
parent.new_record()
END
ax_error_trap:
ax_error_trap_msg = "Trapped error in action command: [" + ax_error_trap_offset + "] " + chr(13) + chr(13) + "Command: " + ax_error_trap_desc + chr(13) + "Error: " + error_text_get()
ax_error_trap_response = ui_msg_box("Action Program Error", ax_error_trap_msg, 2)
IF ax_error_trap_response = 4 THEN ''Retry
RESUME 0
ELSEIF ax_error_trap_response = 5 THEN ''Ignore
RESUME NEXT
ELSE ''Abort
END
END IF
''****
''**** End
All but the first line of the script was created by Alpha when I created the button (I asked it to enter a new record).
Thanks for any help in advance.
I put a button on the form (like Dr. Wayne said) that allows entry. That also works fine. I also needed the button to bring up a new record, so I now have a button that does both things. However, it also forces the current record to be saved if it is pushed again during entry.
My problem is that I need to disable the button until the current record is cancelled or saved so that people don't inadvertently save a record before they are ready since I don't allow them to change a record.
This is the script that I have on the button:
''XBasic
parent.restrict_enter=.f.
DIM ax_choice as C
DIM ax_response as N
DIM ax_dialog as P
ON ERROR GOTO ax_error_trap
DIM ax_error_trap_desc as C
DIM ax_error_trap_offset as C
DIM ax_error_trap_msg as C
DIM ax_error_trap_response as N
ax_error_trap_desc = "Action Script"
ax_error_trap_offset = "0"
ax_error_trap_desc = "New Record"
ax_error_trap_offset = "1"
parent.new_record()
END
ax_error_trap:
ax_error_trap_msg = "Trapped error in action command: [" + ax_error_trap_offset + "] " + chr(13) + chr(13) + "Command: " + ax_error_trap_desc + chr(13) + "Error: " + error_text_get()
ax_error_trap_response = ui_msg_box("Action Program Error", ax_error_trap_msg, 2)
IF ax_error_trap_response = 4 THEN ''Retry
RESUME 0
ELSEIF ax_error_trap_response = 5 THEN ''Ignore
RESUME NEXT
ELSE ''Abort
END
END IF
''****
''**** End
All but the first line of the script was created by Alpha when I created the button (I asked it to enter a new record).
Thanks for any help in advance.
Comment