473,406 Members | 2,220 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,406 software developers and data experts.

Changing the error message on delete key

176 100+
Hi, in my form I can't delete certain records because of referential integrity. Therefore, when I press the delete key on those records which have child fields I get an ms-access error (No3300) message "The records can't be deleted or changed because..." . Is there any way to customize this message?

Thanks a lot for your attention.
Good day.
Jan 11 '07 #1
11 3339
nico5038
3,080 Expert 2GB
Thta's hard as it's a jet-message.
Personally I try to prevent this by blocking the records that can't be deleted.
When you check in the OnCurrent event of the (sub)form or a related record is present, then disable the [Del] button on your form, else enable it.
That way the user has visual feedback or deletion is an option..
Nic;o)
Jan 11 '07 #2
MSeda
159 Expert 100+
You didn't exactly specify how your form works but you should be able to enter some code in the forms beforedeleteconfim event to test for related records before the delete occurs and insert your own msgbox. This will cancel the delete before accesses error message.

If Not IsNull(DLookup("[Qu Quoted by]", "[Quote Table]", "[QU Quoted by] = '" & Me.EmpCode & "'")) Then

MsgBox "Can Not Delete Record Because Associated Records Exist."
Cancel = True

End If

you can add addition dlookups to test for records in other tables by use AND in the one if Statement or use nested ifs.
Jan 11 '07 #3
Michael R
176 100+
Dear Nico and Mseda. Both your advices are helpful. I'll go for Mseda's one as it takes less computer power as the user very seldom has to delete a record.
Jan 11 '07 #4
ADezii
8,834 Expert 8TB
Hi, in my form I can't delete certain records because of referential integrity. Therefore, when I press the delete key on those records which have child fields I get an ms-access error (No3300) message "The records can't be deleted or changed because..." . Is there any way to customize this message?

Thanks a lot for your attention.
Good day.
In the Form's Error() Event, you can set the Response Parameter = acDataErrContinue then your own Custom Error Message. Your Error Message will be displayed while the built in Access Error Message will not.
Jan 12 '07 #5
Michael R
176 100+
In the Form's Error() Event, you can set the Response Parameter = acDataErrContinue then your own Custom Error Message. Your Error Message will be displayed while the built in Access Error Message will not.
Thanks, it sounds the most convinient way,
please tell me how exactly do I set the Response Parameter

Michael.
Jan 25 '07 #6
ADezii
8,834 Expert 8TB
Hi, in my form I can't delete certain records because of referential integrity. Therefore, when I press the delete key on those records which have child fields I get an ms-access error (No3300) message "The records can't be deleted or changed because..." . Is there any way to customize this message?

Thanks a lot for your attention.
Good day.
The correct way to do exactly what you are requesting is by entering code in the Form's Error() Event which can replace the Standard Access Error Message with one that you can customize:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2.     If DataErr = 3200 Then      'Can't Delete because of RI
  3.        MsgBox "You cannot DELETE this Record because of Child Records",   vbExclamation, "Delere Notification"
  4.        Response = acDataErrContionue
  5.     End If
  6. End Sub
Jan 25 '07 #7
missinglinq
3,532 Expert 2GB
Should Response = acDataErrContionue
Be Response = acDataErrContinue
Jan 25 '07 #8
ADezii
8,834 Expert 8TB
Should Response = acDataErrContionue
Be Response = acDataErrContinue
By all means it should! Thanks for pointing out the typo.
Jan 25 '07 #9
missinglinq
3,532 Expert 2GB
You'd hate to get an error message on an error message!
Jan 25 '07 #10
ADezii
8,834 Expert 8TB
You'd hate to get an error message on an error message!
Would that be an Error Error Message?
Jan 25 '07 #11
nico5038
3,080 Expert 2GB
I hate error messages in general. Thus my proposal to prevent them on forehand <LOL>

Nic;o)
Jan 25 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
0
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
1
by: teddysnips | last post by:
Below is the script of a Job called "eFIMS_SendEmail" that I wish to run. The intention is that every day of the week the job will execute a SPROC at timed intervals. For example, the SundayRun...
1
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have...
8
by: mike_solomon | last post by:
I have a button <input type="submit" name="Delete" value="Delete"> This code can not be changed I want to use Javascript to change the type I tried:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.