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

Primary Key Error Message

Status
Not open for further replies.

BoatingGirl

Programmer
Feb 24, 2004
7
US
I am looking for a way to change the error message:

"The field can not contain a Null value because the Required property for this field is set to True. Enter a value in this field."

I understand what the message means, but it really confuses my users. Is there a way that I can change the content of the error message?

I am also having difficulty with when they are getting the error message. The structure of my tables is such that only two fields (call them A and B) are related to the PK field "serial number", and the rest of the fields are related to a different PK. I created the form this way so that the serial number will not always be required, because there are times when there isn't information for fields A, B and Serial Number. However if the user accidentally begins entering information in the Serial Number field, but then realizes their mistake and deletes it, they will get that error message once the field loses focus. The form will not allow the user to continue until a unique value is entered into the Serial Number field. The only way they can get around it is to close the form completely and lose any informaiton that they have already keyed.

Is there is a way to get around it?

Thank you so much!
 
The only way I know to change the default error messaging is to write your own in VBA.

< M!ke >
 
Just an idea on your first dilemma.

Add this code to the combo's before update event.

If IsNull(Me.YourComboName) Then
MsgBox "Please enter a value", vbOKOnly
Me.YourComboName.Undo
End If

I can't test it right now so I am not sure if these are the results you would like.

HTH,
Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top