Uncheck all the checkbox on Continuous Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm not so expert in coding, but I try to find this question in newgroup but
i cant find it. I use the code below but it didn't work, it only uncheck the
first checkbox only, i want to make it uncheck all the checkbox while the
form load, thanks for the help.

Code:
Private Sub Form_Load()
Set statusyes = False
End Sub
 
Try this on a backed up copy of your database
You will need to change NameOfForm to the name of your form
DoCmd.SetWarnings False
If Me.Dirty Then Me.Dirty = False 'Save first.
strSql = "UPDATE NameOfForm SET statusyes = 0 " & _
"WHERE Completed = -1;"

DoCmd.RunSQL strSql
Me.Requery
DoCmd.SetWarnings True
 
Private Sub Form_Load()
With Me.RecordsetClone
.MoveFirst
Do While .EOF = False
Me.statusyes = False
.MoveNext
Loop
End With
End Sub
 
Mike said:
Try this on a backed up copy of your database
You will need to change NameOfForm to the name of your form
DoCmd.SetWarnings False
If Me.Dirty Then Me.Dirty = False 'Save first.
strSql = "UPDATE NameOfForm SET statusyes = 0 " & _
"WHERE Completed = -1;"

DoCmd.RunSQL strSql
Me.Requery
DoCmd.SetWarnings True

This will not work, Mike. An SQL statement must refer to a table or query,
not to a form.
 
Private Sub Form_Load()
With Me.RecordsetClone
.MoveFirst
Do While .EOF = False
Me.statusyes = False
.MoveNext
Loop
End With
End Sub

I try this, didn't work out. And i just learn coding, so give me some
example how to modify the code while you post the code to me, btw, I'm using
Access 2002, thanks for you help.
 
Em...can anyone reply?I need this code asap,i need it for my project, thanks~~

Sorry for double post.
 
Hi,

What does not work? You'll need to explain your form design. What are the
physical user work flow for the user interface?
 
Em...can anyone reply?I need this code asap,i need it for my project, thanks~~

Sorry for double post.

There is only one checkbox on a continuous form.

It's displayed many times, but the data does NOT exist on the form - it exists
in the Table to which the form is bound.

You don't need to do anything with the form; instead, you need to run an
Update query updating the Yes/No field in the underlying table to False.

If you could describe the form, its recordsource, and the purpose of the field
someone should be able to help.

John W. Vinson [MVP]
 
Er...sorry that i didn't give the detail, is like this(example),
i have a form, in Continuous Mode for sure, i have a textbox name text1 and
a checkbox name statusyes,
both box control source is base from a table. In table, i put checkbox data
type to Yes/No. So when i open the form, it only clear the first row checkbox
only, that the problem, clear enough? If didn't just tell me,i give more
detail, thanks for the help.
 
Thanks guys! I got it! Ignore the upper post, thanks a lot! I can empty all
my checkbox for now!
 
Back
Top