The code posted below is for a UserForm, ufAddAssignment. The user inputs values that are then pasted into the worksheet. Along the way we test for valid input values. Most work fine:
cbAddAssignment_Click() works fine
cbClose_Click() works fine
tbRoom_afterUpdate() works fine
tbItem_AfterUpdate() works fine during the test to see if item number exists but when I test for a duplicate record the problem happens.
The code seems to work. When I attempt to add a duplicate record I get the MsgBox, the UserForm unloads and the user is taken to the record they mistakenly attempted to enter. Everything is as desired except that that is when the error message occurs:
Run-time error '-2147417848 (80010108)':
Automation error
The object invoked has disconnected from its clients
While trying to solve the problem I:
commented out "Unload Me." This stopped the error but the UserForm remained on screen.
Changed "Unload Me" to "Unload ufAddAssignment." No change.
Made sure Option Explicit was present (some posts said this would solve problem.) Nope.
When I click the Debug button the sub that is attached to a button to invoke the UserForm, is highlighted
Would you kindly check my code to see if there is a way I can close the form without an error?
Thanks for your time!
Bookmarks