Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

overriding errors

Status
Not open for further replies.

purpledawn

Programmer
Joined
Jun 21, 2001
Messages
50
Location
US
Hi everyone.

I have developed a form with a subform. Some controls on the subform are invisible and are populated from contols on the main form when they are updated.

Some controls on the subform must be populated before the subfrom can be updated, due to referential integrity rules. If the user clicks on the the subform before those subform controls are populated, an error is generated.

Does anyone have any ideas for interrupting the error, displaying my own error message, and shifting focus back to the main form?

Steve Veltman.
 
Look up error handling in help. Then, you can trap the error and display your own message. Terry M. Hoey
 
Example:

Private Sub YourCommand Click()
On Error GoTo Err_Trap
'Code here
Err_Trap:
Select Case Err.number
Case 12345
Something
Case 12346
Something Else
End Select
End Sub

That's the general Ideer. Tyrone Lumley
augerinn@gte.net
 
Thanks for your help. Your suggestions led me to using the OnError event for the form. This allows me to set the Response value, which contols whether the default error message is shown. That makes it mucho easy! (See Error Event - Event Procedures in Help)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top