Page 1 of 1

Protecting field from accidental change

PostPosted: Mon Jan 09, 2017 6:42 pm
by BRobinsonS
I have a membership database application with MemNo (member number) field string(12).
The Only Text Entry Field is Disabled (not Enabled) which uses MemNo of database field.
In theory the only way to changed the MemNo value is through a routine which I developed to Change from a Temporary member number to permanent member number.
Which updates the dues payment table as well.

However, every once and a while I see the MemNo value is blank or altered from what it should be.
Somehow the MemNo value is changed accidentally when entering another value for different field possibly on another screen.

Is there a way to test that the MemNo field is being altered and alert the user that this is happening?
Other displays of the MemNo is in a simple text label.
Doesn't happen all the time but once in a while.

Thoughts? Solutions?

Re: Protecting field from accidental change

PostPosted: Tue Jan 10, 2017 8:17 am
by virger
Try yjis:
Code: Select all
dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=Yes"


dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=Yes"

Re: Protecting field from accidental change

PostPosted: Tue Jan 10, 2017 8:37 am
by BRobinsonS
ReadOnly seems to refer to Grid. Would it apply to a Text Field too?

Also, to make a change from Temp MemNo to Permanent MemNo, would I have to use dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=No"
Then back to dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=Yes" after the edit?

Re: Protecting field from accidental change

PostPosted: Sat Oct 28, 2017 11:45 am
by BRobinsonS
Still a mystery to me.
MemNum Field on form is Disabled so change would not be made by accident.

Only MemNum field is a text field disabled with other MemNum values displayed by Simple Text (not editable).

There is a Change MemNum used to change a MemNum from Temporary Number to Permanent Number.
Not used after Member has a permanent MemNum.

I do you this routine to correct the error when MemNum gets changed.

Any thoughts ?

Re: Protecting field from accidental change

PostPosted: Sat Oct 28, 2017 1:57 pm
by Gaev
Brian:

From the Help file ...
dbpOpenTable "database id" "table" "subroutine"

database id
The name assigned to the database containing the table you want to open.

table
The name of the table you wish to open.

subroutine
The name of a subroutine from your publication's Subroutine Action. The subroutine specified here will be automatically executed whenever the table is updated or the current record number changes.

... so you can check for any unexpected changes within such a Subroutine.

Re: Protecting field from accidental change

PostPosted: Sun Nov 05, 2017 2:02 pm
by BRobinsonS
Might need some help with this one.
I understand about the subroutine.

How do I focus on the MemNum field in the subroutine to see if it is being changed (i.e. by accident) ?
I would then prompt "Sure you want to change this field? "

Re: Protecting field from accidental change

PostPosted: Sun Nov 05, 2017 3:54 pm
by Gaev
Brian:

I suggest that you first set this subroutine to just report found values for database field called MemNo e.g. ...
Code: Select all
AlertBox "Update Subroutine says" "[myDB.myTable.MemNo]"


Then study what is being reported as you navigate from record to record ... and when you add/change/delete a record.

Armed withis knowledge, you will be able to design a script (for this subroutine) that captures the "before value" (in a non-database variable) and compares it when the record is updated ... if different (or null) you can then report it to user.

Re: Protecting field from accidental change

PostPosted: Sun Nov 05, 2017 4:15 pm
by BRobinsonS
Thanks I will work on the idea.