472,805 Members | 1,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Write Conflict: Form / Subform

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

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE SHOWS SET SHOWS.[Select] = No; ", -1
DoCmd.RunCommand acCmdRefresh
DoCmd.ShowAllRecords
DoCmd.SetWarnings True
resetselect_Exit:
Exit Sub

resetselect_Err:
MsgBox Error$
Resume resetselect_Exit

End Sub

I understand WHY I am getting the write conflict but have not been able
to find a workaround.

The form works exactly as it should. It is basically a series of check
boxes. If you check 1, all other checks are set to null (or -1). I
only get the write conflict when I uncheck a box that is already
checked. It's not a huge issue but will be to the novice user.

I've tried adding DoCmd.RepaintObject acForm, "SHOWS" (as well as
removing the error lines, yeah I know) but the problem is innate.

Any thoughts.....
Thanks, C~

Jun 24 '06 #1
4 8433
There's a range of issues here.

1. Is Select a bound control?
If it is a bound control, the code fires when you change the value.
That means an edit is in progress.
At this point, you are executing a query that changes the data in the table.
That's 2 writes at once: it has to give a write conflict.

If Select is not a bound control, you could just handle the case where an
edit is in progress by adding this line before your DoCmd lines:
If Me.Dirty Then Me.Dirty = False

2. Select is a reserved word in JET.
It is likely to confuse Access and give you problems.
There's a utility here that contains a table named tblBadWord:
Database Issue Checker
at:
http://allenbrowne.com/AppIssueChecker.html
The utility will check your database for these words (and a dozen other
problems if you wish.)

3. Form and subform bound to same table.
This is a completely separate, second reason why you might get write
conflicts. Particularly if there are any memo fields, the chance of a
conflict is high.

But there are other problems with this as well. When you create a new record
in the subform, the field(s)/control(s) named in the subform control's
LinkChildFields property inherit their values from the field(s)/control(s)
named in LinkMasterFields. Typically, Access will assign the primary key
field to these properties. So if the main form is not at a new record, the
subform will try to reuse the same primary key value as the record in the
main form.

If that's not bad enough, if the field is an AutoNumber, this failed write
actually resets the Seed of the AutoNumber to 1 more than the value in the
main form. So, unless the main form happened to be at the last record, the
table is now damaged, and will not accept *any* new records! Not just in
this form, but anywhere - even typing directly into the table - the table is
shot. This happens in all versions of Access from 2000 onwards - even fully
patched, and even in the 2007 beta. More info on this issue:
Fixing AutoNumbers when Access assigns negatives or duplicates
at:
http://allenbrowne.com/ser-40.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<cr*****@cinstall.com> wrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
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

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE SHOWS SET SHOWS.[Select] = No; ", -1
DoCmd.RunCommand acCmdRefresh
DoCmd.ShowAllRecords
DoCmd.SetWarnings True
resetselect_Exit:
Exit Sub

resetselect_Err:
MsgBox Error$
Resume resetselect_Exit

End Sub

I understand WHY I am getting the write conflict but have not been able
to find a workaround.

The form works exactly as it should. It is basically a series of check
boxes. If you check 1, all other checks are set to null (or -1). I
only get the write conflict when I uncheck a box that is already
checked. It's not a huge issue but will be to the novice user.

I've tried adding DoCmd.RepaintObject acForm, "SHOWS" (as well as
removing the error lines, yeah I know) but the problem is innate.

Any thoughts.....
Thanks, C~

Jun 24 '06 #2

Allen Browne wrote:
There's a range of issues here.
1. Is Select a bound control?
Unfortunately, yes. The checkbox is a yes/no field from the SHOWS
table.
I also tried using the Me.Dirty but it then will not allow me to check
any selection at all. It does however solve the write conflict. ;->
2. Select is a reserved word in JET.
Will run the checker. Thanks for heads up.
http://allenbrowne.com/AppIssueChecker.html
The utility will check your database for these words (and a dozen other
problems if you wish.)

3. Form and subform bound to same table.
This is a completely separate, second reason why you might get write conflicts. Particularly if there are any memo fields, the chance of a conflict is high.


No memo field in the table.
The Main form is a single form used to input different data and create
a new record. Once the data is in, the subform reflects the added data
in a continuous form to select which show to process. Unfortunately
they are both running, in the end, from the same table.

As for the "new record in the subform and the autonumber, No data
allowed to be added in the subform and the autonumber is taken from the
mainform. Of course, I could be wrong, as always.

New shows are added to the form and a refresh after update adds the new
line to the continuous subform. The Yes/No field is not located on the
mainform, although it is taken from the same table and reflected on the
subform. The only time it becomes an issue is when I uncheck.
Otherwise the code works perfectly and without issue. Hope this helps.

I will run the checker and see what's going on there. I wouldn't have
an issue except it runs perfectly with the only exception of when I
uncheck the box.

Thanks for your help.

C~

Jun 24 '06 #3
For the way you describe this, using the AfterUpdate event of the check box
might work. The save should succeed in that event, unless there are other
issues.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<cr*****@cinstall.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...

Allen Browne wrote:
There's a range of issues here.
1. Is Select a bound control?


Unfortunately, yes. The checkbox is a yes/no field from the SHOWS
table.
I also tried using the Me.Dirty but it then will not allow me to check
any selection at all. It does however solve the write conflict. ;->
2. Select is a reserved word in JET.


Will run the checker. Thanks for heads up.
http://allenbrowne.com/AppIssueChecker.html
The utility will check your database for these words (and a dozen other
problems if you wish.)

3. Form and subform bound to same table.
This is a completely separate, second reason why you might get write

conflicts. Particularly if there are any memo fields, the chance of

a
conflict is high.


No memo field in the table.
The Main form is a single form used to input different data and create
a new record. Once the data is in, the subform reflects the added data
in a continuous form to select which show to process. Unfortunately
they are both running, in the end, from the same table.

As for the "new record in the subform and the autonumber, No data
allowed to be added in the subform and the autonumber is taken from the
mainform. Of course, I could be wrong, as always.

New shows are added to the form and a refresh after update adds the new
line to the continuous subform. The Yes/No field is not located on the
mainform, although it is taken from the same table and reflected on the
subform. The only time it becomes an issue is when I uncheck.
Otherwise the code works perfectly and without issue. Hope this helps.

I will run the checker and see what's going on there. I wouldn't have
an issue except it runs perfectly with the only exception of when I
uncheck the box.

Thanks for your help.

C~

Jun 24 '06 #4

Allen Browne wrote:
For the way you describe this, using the AfterUpdate event of the check box
might work. The save should succeed in that event, unless there are other
issues.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<cr*****@cinstall.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...

Allen Browne wrote:
There's a range of issues here.
1. Is Select a bound control?


Unfortunately, yes. The checkbox is a yes/no field from the SHOWS
table.
I also tried using the Me.Dirty but it then will not allow me to check
any selection at all. It does however solve the write conflict. ;->
2. Select is a reserved word in JET.


Will run the checker. Thanks for heads up.
http://allenbrowne.com/AppIssueChecker.html
The utility will check your database for these words (and a dozen other
problems if you wish.)

3. Form and subform bound to same table.
This is a completely separate, second reason why you might get write

conflicts. Particularly if there are any memo fields, the chance of

a
conflict is high.


No memo field in the table.
The Main form is a single form used to input different data and create
a new record. Once the data is in, the subform reflects the added data
in a continuous form to select which show to process. Unfortunately
they are both running, in the end, from the same table.

As for the "new record in the subform and the autonumber, No data
allowed to be added in the subform and the autonumber is taken from the
mainform. Of course, I could be wrong, as always.

New shows are added to the form and a refresh after update adds the new
line to the continuous subform. The Yes/No field is not located on the
mainform, although it is taken from the same table and reflected on the
subform. The only time it becomes an issue is when I uncheck.
Otherwise the code works perfectly and without issue. Hope this helps.

I will run the checker and see what's going on there. I wouldn't have
an issue except it runs perfectly with the only exception of when I
uncheck the box.

Thanks for your help.

C~


Oh, the agony. Seems I have a lot of "issues" all with "Jet reserved
words". Thank you so much for the heads up. Very nice utility. I
don't know if this will solve my write conflict problem but I
definately have some cleanup to do.

Thanks again, C~

Jun 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Not Me | last post by:
Hi, I'm experiencing a lot of 'write conflict' errors from a certain subform in my access database linked to sql server tables. I've heard in the past, and successfully avoided the problem by...
1
by: shumaker | last post by:
I've loked over older messages on this, but haven't found a solution. I have a datasheet of records, and each record has a subform that can be viewed with the expand '+' symbol. The subform...
0
by: manning_news | last post by:
Using A2K. I've got a form for clients that has a subform that is a cartesian product between client ID and a lookup table for types of income. So each client has the exact same number of income...
3
by: rivka.howley | last post by:
I recently added some code to the BeforeUpdate event of a text box on a form. The code uses the new value in the text box to recalculate some values in another table, which is shown in a subform on...
5
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...
1
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...
1
by: S.Dickson | last post by:
I have a database with access as front end and Mysql as back end. I am gettting the following 'Write Conflict' Error. when i am on my order form, This form does has a subform where i enter all the...
6
by: jpatchak | last post by:
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...
1
by: kjworm | last post by:
Greetings all, I have a main form that does not have a record source. On that main form is a combobox that looks up values from the main table and is based off of a stored query. I also have a...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{

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.