Protecting field from accidental change

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Locked
User avatar
BRobinsonS
Posts: 355
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada
Contact:

Protecting field from accidental change

Post 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?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Protecting field from accidental change

Post by virger »

Try yjis:

Code: Select all

dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=Yes"
dbpSetFieldProperties "Base" "Table" "Field" "ReadOnly=Yes"
COSTA RICA
PURA VIDA
User avatar
BRobinsonS
Posts: 355
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada
Contact:

Re: Protecting field from accidental change

Post 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?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
Posts: 355
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada
Contact:

Re: Protecting field from accidental change

Post 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 ?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Protecting field from accidental change

Post 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.
User avatar
BRobinsonS
Posts: 355
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada
Contact:

Re: Protecting field from accidental change

Post 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? "
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Protecting field from accidental change

Post 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.
User avatar
BRobinsonS
Posts: 355
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada
Contact:

Re: Protecting field from accidental change

Post by BRobinsonS »

Thanks I will work on the idea.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
Locked