473,387 Members | 1,455 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,387 software developers and data experts.

BeforeDelConfirm stopped working

Hi,
I had this perfectly working form "Patients" where I had a custom delete confirmation in BeforeDelConfirm event. But suddenly I found out that the delete confirmation is not working. I have no clue what went wrong. I put a Debug.Print in the BeforeDelConfirm sub to see if it fires at all. As I guessed it is not fired and delete command continues without confirmation.

I created a new form "Patients1" using access wizard where the delete confirmation works fine.

I am using Access 2010 and accdb format. I have attached the my database. Please help me to resolve this issue.

Thanks,
Robin
Attached Files
File Type: zip btf.zip (126.9 KB, 120 views)
Sep 16 '10 #1
7 3718
I figured out that I have converted the ID field from integer to text (PT0001,PT0002,..) which caused the problem. But do not find any apparent reason how it may cause the problem.

I tested with entering numeric Id in the table and delete confirmation works. Please help.
Sep 16 '10 #2
NeoPa
32,556 Expert Mod 16PB
You'll need to post some more information Robin. There are no details about any relevant design issues. Posting an attachment is not to be relied on. The question needs to be fully explained in the text.

PS. Even those who do open attachments largely require them to be in 2003 or earlier format. Even a readable attachment though, cannot be considered as fitting in place of a properly worded question. Only as further clarification at best, or to give an opportunity for seeing the problem for themselves. Never as part of the question. Never an excuse for missing out important detail in the question.

PPS. It's just the sort of thing that will cause a thread to remain unanswered. A clearly described question is very much more likely to garner responses.
Sep 20 '10 #3
patjones
931 Expert 512MB
I'm going to go along with NeoPa here and ask you to post the code. I've looked at attachments for other threads, however that has been in cases where all else failed. There could be something simple in your code that we can just pick out immediately. Thanks.

Pat
Sep 20 '10 #4
Thank you NeoPa and Pat.

Firstly, let me tell you this is my first project in Access. I wrote the following Delete_Click sub to delete records in form Patients. I wanted a custom delete confirmation, so I added the BeforeDelConfirm event. Until this point everything working in order when I decided to change the Id field from numeric to text (PT0001, PT0002,..) and made the changes in the code accordingly. But I found records are deleted without the confirmation msg. Incidentally I discovered that if I use a numeric value as Id instead of text, it shows the confirmation msg. I am totally clueless about this behavior as there is no reference to Id field in any of these functions.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Delete_Click()
  2.     On Error GoTo ErrorHandler:
  3.     Screen.PreviousControl.SetFocus
  4.  
  5.     If Not Me.NewRecord Then
  6.         RunCommand acCmdDeleteRecord
  7.     End If
  8.  
  9.     If Me.NewRecord And Not Me.Dirty Then
  10.         RunCommand acCmdRecordsGoToLast
  11.     End If
  12.  
  13.     If Me.NewRecord And Me.Dirty Then
  14.         RunCommand acCmdUndo
  15.         RunCommand acCmdRecordsGoToLast
  16.     End If
  17.     Exit Sub
  18.  
  19. ErrorHandler:
  20.     If Err.Number = 2501 Then 'Catches the error raised by cancelling DoCmd action
  21.         Err.Clear
  22.     Else
  23.         MsgBox "Error # " & Err.Number & vbCrLf & _
  24.                 vbCrLf & Err.Description
  25.         Beep
  26.     End If
  27. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
  2.     Dim strMessage As String
  3.     Dim intResponse As Integer
  4.     On Error GoTo ErrorHandler:
  5.     strMessage = "Are you sure, you want to delete the current record?"
  6.     intResponse = MsgBox(strMessage, vbYesNo + vbQuestion, "Continue delete?")
  7.  
  8.     If intResponse = vbYes Then
  9.         Response = acDataErrContinue
  10.     Else
  11.         Cancel = True
  12.     End If
  13.     Exit Sub
  14.  
  15. ErrorHandler:
  16.     MsgBox "Error # " & Err.Number & vbCrLf & _
  17.             vbCrLf & Err.Description
  18.  
  19. End Sub
I hope I could clarify the question.

Thanks,
Robin
Sep 20 '10 #5
patjones
931 Expert 512MB
I set your situation up in my test database and found the same thing...that the before delete event is not firing. No time to research further right now but I certainly am going to look into it.

Pat
Sep 20 '10 #6
patjones
931 Expert 512MB
Robin,

I apologize for the delay. I'm not sure if you managed to resolve this issue. I discovered that the BeforeDelConfirm event will not fire if the the Confirm Record Changes box is cleared under Access Options. When I set that option and tried it again, the event fired properly.

Give it a try and let us know. If it doesn't work, we can look into it further.

Pat
Sep 24 '10 #7
Hi Pat,
Thanks for ur reply. The bizarre thing which I had also mentioned earlier is that if I use a numeric value as Id instead of text, it shows the confirmation msg. If "Confirm Record Changes" is unchecked it shouldn't fire at all. Anyway I have checked in the settings and found alright.

Robin
Sep 24 '10 #8

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

Similar topics

5
by: Bill | last post by:
I used to be able to run the following ASP code on our corp machine (W2K Server Edition and IIS-5) and successfully send a net-msg to anyone on our intranet. Last week it stopped working... and...
4
by: Dag Sunde | last post by:
I've been working on a system that have been running for the last couple of years, but stopped working on my dev. machine after reinstalling WinXP yesterday. To my knowledge, it have been set up...
2
by: Dag Sunde | last post by:
I have the following code fragment in one of my pages: if (typeof document.getElementById('myApplet').getTableAsSDV != 'undefined') { rowBuffer =...
6
by: Susan Bricker | last post by:
Hi. Does anyone have a clue why my mouse wheel stopped working while I was working on the VB behind a form in MS/Access? I would swear that the mouse wheel was working a short time ago. I've...
4
by: vzaffiro | last post by:
Our Development Server (windows 2003, framework 1.1) was working great for months, then one day all the client side validators stopped working. Only the server side validation is working. Our code...
0
by: Oenone | last post by:
My VS2005 Edit and Continue function appears to have stopped working in my VB project. It definitely was working, but now when I run my project (a WinForms project) and break into it, I am...
4
by: JohnB111 | last post by:
Hi Environment: Windows XPPRO SP2 IIS 5.1 AVG Anti Virus (Not script Blocking) The following code used to work perfectly on my local development machine and still does on my web server.
3
by: Just D. | last post by:
All, Did anybody see this bug? We're having two login pages in a huge application, both are with validation controls. Everything works just great on two developer's machines working under...
2
by: Rico | last post by:
Hello, I have an ASP.net application, it's a third party forum software running on an SQL Server back end. This application was working fine with no issues. Then yesterday, without being...
1
by: rickcasey | last post by:
I wonder if anyone has experienced something like this, as it seems truly bizarre and is causing me to tear out my hair (what little there is left of it).... The exec() function just suddenly...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.