Hello:
In GP 2013 R2 (12.00.1920), I have VBA code for a customer-based window.
My code works perfectly, as long as the end user types in an existing customer ID into the "Customer ID" field. But, if the user accidentally types in a customer ID that does not exist, GP brings up the dialogue box "This Customer ID does not exist."
When the user hits "OK", afterward, VBA brings up that "Debug" window saying among other things that the integrity of the application could be violated. (This is the "Run-Time Error '1007'" window that mentions "Unsafe Operation".)
Although the end user can click "End" on this window and move on, it's still an issue that needs to be eliminated.
Specifically, when I troubleshoot this VBA error by clicking the "Debug" button instead of the "End" button, the yellow breakpoint in the Visual Basic Editor appears within my first of five "AfterUserChanged" events.
What I'm trying to say is that the end user has changed the Customer ID field, of course, by entering a bad Customer ID and tabbing out of the field. My VBA code does not know how to handle this.
I tried to fix this, by adding the code below to place the focus of GP back into the Customer ID field and so that the end user can enter a correct customer ID for my code to run.
But, the same "Run-Time Error '1007'" window appears.
How do I eliminate this issue?
Thanks!
John
Private Sub Window_AfterModalDialog(ByVal DlgType As DialogType, PromptString As String, Control1String As String, Control2String As String, Control3String As String, Answer As DialogCtrl)
Select Case PromptString
Case "This customer ID does not exist."
If Answer = dcOK Then
CustomerID.Focus
End If
Case Else
End Select
End Sub
*This post is locked for comments