Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS 500 Customer
SSCIT
Posts: 5
Registered: 07-10-2009
0

bSave and This record has been modified by another user

Hello,

I am trying to block users form inadvertantly copy and posting CRLFs into text fields in Maintain Customers.

I am using the below code to do this.  The problem I am hiavng is if bSave fires and cancels the save, the next attempt by that user to save (after deleting the bad chars) results in "This record has been modified by another user.  Your changes will not be saved"  The user must then exit the record completely, go back in, and then enter the 'clean' data and save.

Am I missing something here?

 

Sub Form_Save(bSave)

if instr(Form.Controls("txtAddressLine", 1) & Form.Controls("txtAddressLine", 2) & Form.Controls("txtAddressLine", 3) & Form.Controls("txtAddressLine", 4) & Form.Controls("txtAddressLine", 5), chr(13)) > 0 or instr(Form.Controls("txtAddressLine", 1) & Form.Controls("txtAddressLine", 2) & Form.Controls("txtAddressLine", 3) & Form.Controls("txtAddressLine", 4) & Form.Controls("txtAddressLine", 5), chr(10)) > 0 then

  msgbox "Address cannot contain a Carriage Return or Linefeed. Please remove it before saving.", 0, "MAS 500"

  msgbox "Save Canceled", 0, "MAS 500"

  bsave = false

end if

 

if instr(Form.Controls("txtContName") & Form.Controls("txtContTitle") & Form.Controls("txtPhone") & Form.Controls("txtPhone2") & Form.Controls("txtFax") & Form.Controls("txtFaxExt") & Form.Controls("txtEmail"), chr(13)) > 0 or instr(Form.Controls("txtContName") & Form.Controls("txtContTitle") & Form.Controls("txtPhone") & Form.Controls("txtPhone2") & Form.Controls("txtFax") & Form.Controls("txtFaxExt") & Form.Controls("txtEmail"), chr(10)) > 0 then

  msgbox "Contact cannot contain a Carriage Return or Linefeed. Please remove it before saving.", 0, "MAS 500"

  msgbox "Save Canceled", 0, "MAS 500"

  bsave = false

end if

 

End Sub

Sage MAS Partner
LouDavis
Posts: 545
Registered: 10-29-2008
0

Re: bSave and This record has been modified by another user

It appears your Customizer code is conflicting with the standard processes of the form (which by the way will always win).  You may have to rethink how you want to accomplish what you want do in order to get around the issue.   This seems to be one of those cases where Customizer and the standard code of a form aren't playing well together due to the limitations of what Customizer was orignally designed for..  Maybe someone else has run into this issue and found another way to check the values you want for carriage returns using vbScript.

 

Another option is to modify the task itself using the SDK to easily accomplish what it is you need done.  If you do not have the SDK, contact your reseller to see if they can do this for you.

Louis Davis MCSD, MCAD, MCITP
e2b teknologies, inc
www.e2btek.com

Sage MAS 90 Customer
hyanaga
Posts: 34
Registered: 11-16-2010
0

Re: bSave and This record has been modified by another user

Unfortunately, I have run into this with bSave also, no matter what the code is doing.  I've run SQL traces to try to pinpoint the issue, and it appears that although this code is supposed to run before anything is saved, it's not.  MAS is saving something behind the scenes, and probably not rolling it back properly, so when you try to save again, it thinks the record is still in use.

 

I've heard that Sage is working on improvements for Customizer, I'm hoping this is one of them.

 

 

Hollie

Thanks!
Hollie