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: - strList = cbListFilter.Value
-
iresponse = MsgBox("Are you sure? If you click yes, data for this prospect will be unrecoverable!", vbYesNo, "Confirm Delete")
-
If iresponse = vbNo Then Exit Sub
-
Dim iDelID As Long, iProspectNumber As Long, strListName As String
-
iProspectNumber = Me![Prospect Number]
-
strListName = Me![List Name]
-
iDelID = Me![ID]
-
-
'This section of code deletes the record from my main form.
-
Dim IQRST As New ADODB.Recordset
-
Dim IQSQL As String
-
IQSQL = "SELECT * FROM [dbo_PR Only Info] WHERE [ID] = " & iDelID
-
DoCmd.RunCommand acCmdSaveRecord
-
IQRST.Open IQSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
-
IQRST.Delete
-
IQRST.Close
-
Set IQRST = Nothing
-
-
'This section of code deletes records from a link table - this shouldn't
-
'come into play here.
-
IQSQL = "SELECT * FROM [dbo_tblTestLink] WHERE [ProspectList] = '" & strListName & _
-
"' AND [ProspectNumber] = " & iProspectNumber
-
IQRST.Open IQSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
-
If IQRST.RecordCount = 0 Then GoTo Exit_Delete_Current_Record_Click
-
IQRST.MoveFirst
-
Do
-
IQRST.Delete
-
IQRST.MoveNext
-
Loop Until IQRST.EOF = True
-
-
Exit_Delete_Current_Record_Click:
-
IQRST.Close
-
Set IQRST = Nothing
-
ReNumber strList
-
'------------------------------------------------------------------------------
-
'Everything works fine up until this point. If either of these requery lines
-
'are run, I get a write conflict error.
-
Me.Form.Requery
-
'Me.Final_Action.Form.Requery
-
Exit Sub
Thanks,
Josh
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.
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?
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.
MMcCarthy 14,534
Recognized Expert Moderator MVP
You could try putting
Before -
Me.Requery ' replaces Me.Form.Requery as Me actually means the form.
-
Does this make any difference?
Mary
You could try putting
Before -
Me.Requery ' replaces Me.Form.Requery as Me actually means the form.
-
Does this make any difference?
Mary
Sorry, Mary. That makes no difference. Any other ideas?
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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.
|
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...
|
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...
|
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.
|
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
| |
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 -
|
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
|
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!!!
...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |