# Error Occurred Access Violation when attempting to edit attribute added via JS

**URL:** <https://forums.toadworld.com/t/error-occurred-access-violation-when-attempting-to-edit-attribute-added-via-js/49160>\
**Category:** Toad Data Modeler\
**Created:** [February 27, 2020, 11:00am UTC](https://forums.toadworld.com/t/error-occurred-access-violation-when-attempting-to-edit-attribute-added-via-js/49160 "2020-02-27T11:00:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Michal.Vasut](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/michal.vasut/32/10025_2.png) [@Michal.Vasut](https://forums.toadworld.com/u/Michal.Vasut)\
**Post date:** [February 27, 2020, 12:23pm UTC](https://forums.toadworld.com/t/error-occurred-access-violation-when-attempting-to-edit-attribute-added-via-js/49160/2 "2020-02-27T12:23:22Z")

</div>

Hello Sandy,

as @Daril sugested in other your post ([Can't Set Attribute Domain in LER Model via JS script](https://forums.toadworld.com/t/cant-set-attribute-domain-in-ler-model-via-js-script/49158)), the corect way how to assign DataType (or Domain) to another attribute is via

`NewAttribute.ChangeDataType(DTorDomain);`

I've tried this approach and it should fix also this issue with access violation.

I hope this will help,

Michal

---

_[View the full topic](https://forums.toadworld.com/t/error-occurred-access-violation-when-attempting-to-edit-attribute-added-via-js/49160)._
