Error: Run-time error ‘1007’: Unsafe Option. An attempt was made to set a value which violates the application’s business logic. This operation could compromise the integrity of the application.

Error:

After selecting a Customer ID in the Make a Selection window and tabbing off the Customer ID field in the Customer Maintenance window, you receive the following errors:

Microsoft Dynamics GP warning message:

This customer ID already exists. Please enter a new Customer ID.

Microsoft Visual Basic error message:

Run-time error ‘1007’:

Unsafe Option. An attempt was made to set a value which violates the application’s business logic. This operation could compromise the integrity of the application.

Cause:

The VBA code on the SmartField enabled field (Customer ID) is using Change Event.

Resolution:
Change the VBA code on the Customer ID field from Change Event to AfterUserChange Event.