473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Suppressing Access' table error messages

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
7 2076
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
40
by: Dave Hansen | last post by:
Please note crosspost. Often when writing code requiring function pointers, it is necessary to write functions that ignore their formal parameters. For example, a state machine function might...
8
by: PW | last post by:
Hi, There is code in Alison Balter's excellant "Mastering Access 2003" to create a list of error codes and descriptions but it only generates error messages 3 through 94. Is there a website...
5
by: Don Li | last post by:
Hi, A web app server package that I'm using includes a bunch of open source UI components (heavy with javascripts). Inevitably it has bugs, e.g. "undefined" is null or not an object. This...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.