Check/Uncheck All, write conflict

2

2vao

Hello,

I have a form +subform, on the subform (countinuous form) I have a check
box. on the main form I have an unbound check box that I want to
check/uncheck all the check boxes of my records on my subform. I have an
update query to perform that task.
-Problem 1: after ticking/unticking the check box on the main form, I get
all the check boxes on my subform ticked except the first record where the
focus is.
-Problem 2: I get a write conflict message " Save records or Copy to
clipboard or Drop change "

Can someone assist ?

Many thanks.
 
A

Albert D. Kallal

2vao said:
Hello,

I have a form +subform, on the subform (countinuous form) I have a check
box. on the main form I have an unbound check box that I want to
check/uncheck all the check boxes of my records on my subform. I have an
update query to perform that task.

You have to bind that text box or check box to something. So, two choices:

Add a check box column to the table, and then bind that checkbox to that
column.

Or, you can use my multi-select example here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

The above example shows you how to select multiple items from a continues
form, and then use those selections for whatever.

The nice feature of this example is that it does not use a actual field in
the database to accomplish this.

-Problem 2: I get a write conflict message " Save records or Copy to
clipboard or Drop change "

If you run some update on a records that are "dirty", then you get that
conflict (the other user changing things is in fact your code). Just ensure
you force a disk write before you run any update(s) on potentially the same
record that may already be dirty.

the code to force a disk write is:

if me.dirty = true then me.Dirty = false

......your update code goes here......

So, just make sure you force a disk write of the record as above......
 
2

2vao

Thank you Albert, the link you gave has many helpful tips and samples, thank
you for sharing. I actually saved most of the exemples.
I managed to find out the cause of my problem but it led me to another
obstacle.
The reason why I got problem 1 and the write conflict message was because I
have one field ( field2) in my table that copies the value of another field
(field1) of the same table ( the reason why I created that 2nd field is
because I want to record the initial value of field1 before its value changes
).
my code was
Private Sub Form_Current()
Me.field2.value = Me.field1
End sub

After removing the above code, my check box works perfectly- however I could
not copy the value of field1 one anymore. Would you know a solution to this ?
I still want to copy the value of filed1 and be able to use the check/uncheck
all feature.
Many thanks.
 
A

Albert D. Kallal

because I want to record the initial value of field1 before its value
changes
).
my code was
Private Sub Form_Current()
Me.field2.value = Me.field1
End sub

I don't think we need the above in the on-current event. I mean just using
the page up/down or browsing reocrds is going to cause that code to run...

I would think we ONLY want that code to run when you actually are modifying
the contensts of field1.

So, in field1 AFTER UPDATE event which ONLY fires if you made changes, you
would go:


me.Field2.Value = me.field1.OldValue

Using the on-current event fires all the time...even when you don't
edit/modify anything in the record.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top