473,748 Members | 9,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write conflict when form is requeried after record is deleted.

76 New Member
Hello,

I have a main form with one subform. I have a command button on the main form to delete the current record. Below is my code. The tables on which the main form and subform are based cascade deletions and updates, so getting rid of the record in the table for the main form should delete any corresponding records in the table for the subform. Everything appears to be working correctly in this code from the standpoint of the tables. However, when I requery the form (or subform), I get write conflict errors, saying "This record has been changed by another user since you started editing..." I am offered the options of dropping the changes or copying to the clipboard. There is another button called "Save Record" that is disabled on this error message.

A couple of additional facts that might be relevant - the form is an .mdb file that is linked to tables hosted on SQL Server. Like I said, it appears that everything is working fine from the perspective of the tables, so I'm not sure that is relevant. Here is my code for the command button:

Expand|Select|Wrap|Line Numbers
  1. strList = cbListFilter.Value
  2. iresponse = MsgBox("Are you sure?  If you click yes, data for this prospect will be unrecoverable!", vbYesNo, "Confirm Delete")
  3. If iresponse = vbNo Then Exit Sub
  4. Dim iDelID As Long, iProspectNumber As Long, strListName As String
  5. iProspectNumber = Me![Prospect Number]
  6. strListName = Me![List Name]
  7. iDelID = Me![ID]
  8.  
  9. 'This section of code deletes the record from my main form.
  10. Dim IQRST As New ADODB.Recordset
  11. Dim IQSQL As String
  12. IQSQL = "SELECT * FROM [dbo_PR Only Info] WHERE [ID] = " & iDelID
  13. DoCmd.RunCommand acCmdSaveRecord
  14. IQRST.Open IQSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  15. IQRST.Delete
  16. IQRST.Close
  17. Set IQRST = Nothing
  18.  
  19. 'This section of code deletes records from a link table - this shouldn't
  20. 'come into play here.
  21. IQSQL = "SELECT * FROM [dbo_tblTestLink] WHERE [ProspectList] = '" & strListName & _
  22.         "' AND [ProspectNumber] = " & iProspectNumber
  23. IQRST.Open IQSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  24. If IQRST.RecordCount = 0 Then GoTo Exit_Delete_Current_Record_Click
  25. IQRST.MoveFirst
  26. Do
  27. IQRST.Delete
  28. IQRST.MoveNext
  29. Loop Until IQRST.EOF = True
  30.  
  31. Exit_Delete_Current_Record_Click:
  32. IQRST.Close
  33. Set IQRST = Nothing
  34. ReNumber strList
  35. '------------------------------------------------------------------------------
  36. 'Everything works fine up until this point.  If either of these requery lines
  37. 'are run, I get a write conflict error.
  38. Me.Form.Requery
  39. 'Me.Final_Action.Form.Requery
  40. Exit Sub
Thanks,
Josh
Dec 28 '06 #1
6 4304
NeoPa
32,571 Recognized Expert Moderator MVP
I think that's all relevant information.
The cascaded delete done on the SQL server is recognised as another user...
What I don't understand is why it thinks doing a requery would try to update any data in the first place :s.
Dec 30 '06 #2
jpatchak
76 New Member
I think that's all relevant information.
The cascaded delete done on the SQL server is recognised as another user...
What I don't understand is why it thinks doing a requery would try to update any data in the first place :s.
Do you think this is something I should take over to the SQL Server forum?
Dec 31 '06 #3
NeoPa
32,571 Recognized Expert Moderator MVP
You could try, but on balance I would guess this is an Access issue.
I'm not sure that it's one that can be resolved remotely though I'm afraid. Too many ponderables and too much info you would never think to post. One of those problems that you wouldn't do if you realised what it was you were doing sort of thing.
Dec 31 '06 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
You could try putting

Expand|Select|Wrap|Line Numbers
  1. Docmd.Save
Before

Expand|Select|Wrap|Line Numbers
  1. Me.Requery ' replaces Me.Form.Requery as Me actually means the form.
  2.  
Does this make any difference?

Mary
Jan 1 '07 #5
jpatchak
76 New Member
You could try putting

Expand|Select|Wrap|Line Numbers
  1. Docmd.Save
Before

Expand|Select|Wrap|Line Numbers
  1. Me.Requery ' replaces Me.Form.Requery as Me actually means the form.
  2.  
Does this make any difference?

Mary
Sorry, Mary. That makes no difference. Any other ideas?
Jan 2 '07 #6
jpatchak
76 New Member
Temporary fix - I remove the LinkChildFields and LinkMasterField s properties of the subform before running the ADODB code. Then, just before the main form is requeried, I add them again. This seems to be working - but it's kind of lame.
Jan 2 '07 #7

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

Similar topics

6
94553
by: Max | last post by:
Hi, I have SqlServer 2000 as back end and Access 2000 as front-end. All tables from Sqlserver are linked to Access 2000. I am having write conflict problem with one of my form which is bound to a query which consist of let say tableA , TableB and TableC (all are linked tables from SqlServer. While the form is open I am modifying TableA through code on Form_AfterUpdate Event and getting the following message.
2
15418
by: RC | last post by:
I am getting the following error message. "Write Conflict this record has been changed by another user since you started edting it. If you save the record, you will overwrite the changes...." I have an Access 2002 database running on a single PC, the front and backend have not been separated yet. I have a form where I use a text box to jump from record to record. The form has about 12 bound text boxes on it. The table that is the...
9
3052
by: Paradigm | last post by:
I am using an Access2K front end to a MYSQL database. If I enter a new record in a continuous form the record appears as #deleted as soon as I move to a different record in the form until I requery the form. After the requery the records are in different order to the order that they may be entered in. The record does not seem to be assigned an ID (autonumber ID field) until after it is requeried. My problem is that after requerying the...
5
4731
by: Simon | last post by:
Dear reader, I have two Forms they are both working with dada from the same tables. By typing in some changes in Form-B the changes are also visible in Form-A. There is no record lock set.
4
8504
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q, based on the same table. The code: Private Sub Select_BeforeUpdate(Cancel As Integer) On Error GoTo resetselect_Err
1
2448
by: lorirobn | last post by:
Hi, I have a query that I have been using as a record source for a form with no problems. I just created a new "addnew" form, and added 20 records to the table with this form. The problem I now have is I cannot modify data on these new records using my query. The query's sql is: SELECT tblSpaceUse.* FROM tblSpaceUse; The error I get is: "Write Conflict -
8
12950
by: christianlott1 | last post by:
After searching the group and the net, I just can't believe after all this work I'm going to have to sit through three Write Conflict messages when I want to roll back and delete a record. The action rolls back a new hire record, deleting it from a joining table between employee and position - tblPosEmpRecord. It's a many to many join. The new hire action updates the employee with a new position and logs
1
2477
by: stuart | last post by:
I have a list of records in a subform that a user can either edit or delete. This is an unbound form. If the user deletes a record, I want to refresh the form, and then position the cursor on the next record on that subform. This seems like that this should be a fairly easy thing to accomplish, but I cannot get it to reposition the cursor on the next record. The following is my code segment: Any help would be greatly appreciated!!! ...
1
3827
by: MerlinS | last post by:
Using Access 2003. I have a form and a subform. On the main form, one of the fields is a lost box, which lists line numbers ie 1, 2, 3 etc. Then the list box is clicked, the subform corresponding to the line number info is shown. When a new record is added to the subform the new line number is added and is shown in the main form list box. The list box on the main form gets the focus and the new line number is highlighted. However the new...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.