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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error 2169 1

Status
Not open for further replies.

directorz

Technical User
Mar 4, 2003
142
US
Good morning,
I am having a problem at the point where I close a form. I receive an error #2169 with no explanation or option other than 'OK'. What language do I need in the code to display what this means in order to clarify it and give a user other options. Currently, this is the coding I have.

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 7753
If Screen.ActiveControl.Name = "UnboundTextBox" Then
Response = acDataErrContinue
Else
MsgBox DataErr, vbCritical
Response = acDataErrContinue
End If
Case Else
MsgBox DataErr, vbCritical
Response = acDataErrContinue
End Select
End Sub

Thank you,

Directorz
 
2169 means that you can't save the record (it's anybody's guess why, but you might have a required field missing or a validation rule not satisfied when someone tries to save).
I don't know how you can get the message to display if it doesn't display already, but the lack of a message is a problem that has been reported a number of times.
 
Lupins46,
Well, it does display. Problem is, the user won't know what it means. I would like to change to wording of it to something like "can't save record" or something other than just the generic 2169
 
The error displays on the form screen when attempting to close
 
Create an error handler for the event causing the error. There are also ways (I believe) to change the form level error messages. Try searching around in the FAQ's for "custom error messages" or "form level errors" - something like that should give some very helpful results.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
kjv1611,
Yes, I think that's the only way. Trap it then do a custom arrangement. Thank you for the tip!

Directorz
 
What happens if you try to trap for 2169 in the forms error routine (the one you posted initially)?

Just with the following action/lyric:

[tt]case 2169
msgbox "closing without saving..."
Response = acDataErrContinue[/tt]

- but if you're getting a 2169, you're surely having a 3314, 3022, 3317 and/or perhaps others before that pops up?

Roy-Vidar
 
RoyVidar,
If I trap 2169, I can get a 'closing without saving' message, but it is preceeded by a 2169 error window, which is the one I want to modify. I get no other errors other than 7753.

The goal would be to provide the user, at the point of the error, the option of closing the form and not saving or going back to the form, correcting the problem, then saving. I'm still trying to isolate the cause of the error.

Directorz
 
If I'm not entirely off, I think the reason you get 2169 with nothing but an OK button is evident in the code you posted:

[tt] Case Else
MsgBox DataErr, vbCritical
Response = acDataErrContinue[/tt]

See - in your form error code, all form errors are "trapped", the 7753 is handled specificly, dependent on the name of the active control.

All other errors (including the 2169) is handled by the Else clause of your Select statement. With that code, you are effectively trapping the 2169, popping up a red ugly msgbox with only the dataerr (2169) and with the response = acdataerrcontinue, you remove the default yes not box with "You can't save this record at this time."

Did you try including my previous suggestion in the form error routine, not only trapping the 2169, but handling it too?

[tt] Select Case DataErr
Case 7753
If Screen.ActiveControl.Name = "UnboundTextBox" Then
Response = acDataErrContinue
Else
MsgBox DataErr, vbCritical
Response = acDataErrContinue
End If
case 2169
msgbox "closing without saving..."
response = acdataerrcontinue
Case Else
MsgBox DataErr, vbCritical
Response = acDataErrContinue
End Select[/tt]

Roy-Vidar
 
RoyVidar,
Right on the head. Yes, I tried your other suggestion but had it in the wrong spot. The generic 2169 is replaced with modified language. Nice RoyVidar, thank you!

Directorz
 
I forgot to 'officially' thank you, thus the star

Directorz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top