By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

Suppressing Access' table error messages

P: n/a
pw
Hi,

I don't want the user so see a message like "index or primary key can
not contain a null value". Instead, I'd like to use a user-friendly
message box.

I have tried putting code in the BeforeUpdate Event to check if the
field is empty, but I get my message plus Access' one.

How do I suppress the messages by Access?

I am using 2003.
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
pw wrote:
Hi,

I don't want the user so see a message like "index or primary key can
not contain a null value". Instead, I'd like to use a user-friendly
message box.

I have tried putting code in the BeforeUpdate Event to check if the
field is empty, but I get my message plus Access' one.

How do I suppress the messages by Access?

I am using 2003.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the Form's OnError event procedure to trap errors like that.

Also, In the form's BeforeUpdate event procedure I run a function to
determine if all required controls have data. If they do I let the
record save. If they don't I cancel the save (Cancel = True).
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnKJfIechKqOuFEgEQLwjgCfR+PwYYAxc+COtdjU6aJ5VA WHpdUAnjHs
Njne/5EB6plsknWxOwAWTuM8
=cajs
-----END PGP SIGNATURE-----
Nov 13 '05 #2

P: n/a
pw
>pw wrote:
Hi,

I don't want the user so see a message like "index or primary key can
not contain a null value". Instead, I'd like to use a user-friendly
message box.

I have tried putting code in the BeforeUpdate Event to check if the
field is empty, but I get my message plus Access' one.

How do I suppress the messages by Access?

I am using 2003.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the Form's OnError event procedure to trap errors like that.


I did, and the error is still showing up. I found out what the error
number is:

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Dim intAnswer_pw As Integer

If DataErr = 3058 Then

If IsNull(Me!txtStateAbbrev_pw) Or Me!txtStateAbbrev_pw = "" Then
strMsg_pw = "The state abbreviation can not be blank."
strTitle_pw = "State missing"
intButtons_pw = vbOKOnly
MsgBox strMsg_pw, intButtons_pw, strTitle_pw
End If

End If

End Sub

Also, In the form's BeforeUpdate event procedure I run a function to
determine if all required controls have data. If they do I let the
record save. If they don't I cancel the save (Cancel = True).


Nice to know. Thanks!
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #3

P: n/a
pw

You can use the Form's OnError event procedure to trap errors like that.


What I should have said is that I am still getting the "primary key"
error message in addition to mine.
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #4

P: n/a
pw wrote:
pw wrote:
Hi,

I don't want the user so see a message like "index or primary key can
not contain a null value". Instead, I'd like to use a user-friendly
message box.

I have tried putting code in the BeforeUpdate Event to check if the
field is empty, but I get my message plus Access' one.

How do I suppress the messages by Access?

I am using 2003.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the Form's OnError event procedure to trap errors like that.

I did, and the error is still showing up. I found out what the error
number is:

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Dim intAnswer_pw As Integer

If DataErr = 3058 Then

If IsNull(Me!txtStateAbbrev_pw) Or Me!txtStateAbbrev_pw = "" Then
strMsg_pw = "The state abbreviation can not be blank."
strTitle_pw = "State missing"
intButtons_pw = vbOKOnly
MsgBox strMsg_pw, intButtons_pw, strTitle_pw
End If

End If

End Sub


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To prevent the error from showing, in the OnError procedure you have to
set the Response parameter to acDataErrContinue. The Response default
is acDateErrDisplay, which means display the error message.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnKoz4echKqOuFEgEQLfaACdEBUnND5mY+YV03R1ABFXYr 8jhNMAoKRT
DdEXcQjzXWbqpuVvqpb0aVhk
=XddZ
-----END PGP SIGNATURE-----
Nov 13 '05 #5

P: n/a
pw
That did it! Thank you so much!
pw wrote:
pw wrote:

Hi,

I don't want the user so see a message like "index or primary key can
not contain a null value". Instead, I'd like to use a user-friendly
message box.

I have tried putting code in the BeforeUpdate Event to check if the
field is empty, but I get my message plus Access' one.

How do I suppress the messages by Access?

I am using 2003.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the Form's OnError event procedure to trap errors like that.

I did, and the error is still showing up. I found out what the error
number is:

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Dim intAnswer_pw As Integer

If DataErr = 3058 Then

If IsNull(Me!txtStateAbbrev_pw) Or Me!txtStateAbbrev_pw = "" Then
strMsg_pw = "The state abbreviation can not be blank."
strTitle_pw = "State missing"
intButtons_pw = vbOKOnly
MsgBox strMsg_pw, intButtons_pw, strTitle_pw
End If

End If

End Sub


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To prevent the error from showing, in the OnError procedure you have to
set the Response parameter to acDataErrContinue. The Response default
is acDateErrDisplay, which means display the error message.


-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #6

P: n/a
pw

To prevent the error from showing, in the OnError procedure you have to
set the Response parameter to acDataErrContinue. The Response default
is acDateErrDisplay, which means display the error message.


If you don't mind me asking - how did you find out about that property
(acDataErrContinue). I searched the help and the books I have didn't
find anything about these properties!

Thanks again!
-pw
remove astericks (*) from e-mail address
(use paulwilliamson at spamcop dot net)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #7

P: n/a
Br
In news:9b********************************@4ax.com,
pw <***paulwilliamson@***spamcop.net> said:
To prevent the error from showing, in the OnError procedure you have
to set the Response parameter to acDataErrContinue. The Response
default is acDateErrDisplay, which means display the error message.


If you don't mind me asking - how did you find out about that property
(acDataErrContinue). I searched the help and the books I have didn't
find anything about these properties!


It's not a property. It's a constant. Lookup the help for the OnChange
event.
--
regards,

Bradley

A Christian Response
www.pastornet.net.au/response
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.