CheckBox

G

Guest

Hello Group,

I'm trying to create a button in a continues form that can uncheck all
checkbox when I click on it. The following code uncheck only the checkbox
that I’m on. Is there something that I’,m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting
 
A

Andi Mayer

Hello Group,

I'm trying to create a button in a continues form that can uncheck all
checkbox when I click on it. The following code uncheck only the checkbox
that I’m on. Is there something that I’,m over looking?
Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
ctl.Value = False
End If
Next ctl
End Sub
 
F

fredg

Hello Group,

I'm trying to create a button in a continues form that can uncheck all
checkbox when I click on it. The following code uncheck only the checkbox
that I¢m on. Is there something that I¢,m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName = 0;",
dbFailOnError
End Sub
 
G

Guest

Thanks fredg the code worked

fredg said:
Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName = 0;",
dbFailOnError
End Sub
 
G

Guest

Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection = 0;"
dbFailOnError

End Sub
 
D

Douglas J. Steele

You're missing the comma between the SQL statement and the dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection =
0;"
dbFailOnError

End Sub

Antonio said:
Thanks fredg the code worked
 
G

Guest

Hi Douglas,

Thanks for your help that works but how come i can't see the result right
away instead I can only see everything is cleared when I run a query with a
button that I created on the form. Why when I click on the button it doesn't
clear everything right away! Also when I unchecked a check box the (last
one) that I unchecked shows up on my query as check instead of uncheck.
Anyone has that problem before.

Douglas J. Steele said:
You're missing the comma between the SQL statement and the dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection =
0;"
dbFailOnError

End Sub

Antonio said:
Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can uncheck
all
checkbox when I click on it. The following code uncheck only the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName = 0;",
dbFailOnError
End Sub
 
G

Guest

Hi Douglas,

It's really driving me crazy. In my continues form when I only select the
first three items check box the last one that I checked will not show up when
I click on the query button why is that and vise vera when I uncheck it the
last one I uncheck shows up as checked on my query. This is driving me nuts.
Please Please help!!! Thanks. I am using access 2003.

Douglas J. Steele said:
You're missing the comma between the SQL statement and the dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection =
0;"
dbFailOnError

End Sub

Antonio said:
Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can uncheck
all
checkbox when I click on it. The following code uncheck only the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName = 0;",
dbFailOnError
End Sub
 
D

Douglas J. Steele

Try issuing a Requery on your form after you run the SQL.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

It's really driving me crazy. In my continues form when I only select the
first three items check box the last one that I checked will not show up
when
I click on the query button why is that and vise vera when I uncheck it
the
last one I uncheck shows up as checked on my query. This is driving me
nuts.
Please Please help!!! Thanks. I am using access 2003.

Douglas J. Steele said:
You're missing the comma between the SQL statement and the dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a
continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection =
0;"
dbFailOnError

End Sub

:

Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can
uncheck
all
checkbox when I click on it. The following code uncheck only the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName =
0;",
dbFailOnError
End Sub
 
G

Guest

Hi Douglas,

How do I program a requery? There is actually a refresh button that I can
create from the tool bar wizard. But I think it's a hazzle that I have to
keep clicking on the refresh button for every little changes. How come when
I used the code to select clear all it doesn't refresh by itself instead I
have to use a refresh button to do that.
So the bottom line is I want the system to refresh the changes after I click
on the clear all or select all button that I created instead of clicking on
the refresh button contantly. Thank you so much.

Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0;",
dbFailOnError

End Sub

Douglas J. Steele said:
Try issuing a Requery on your form after you run the SQL.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

It's really driving me crazy. In my continues form when I only select the
first three items check box the last one that I checked will not show up
when
I click on the query button why is that and vise vera when I uncheck it
the
last one I uncheck shows up as checked on my query. This is driving me
nuts.
Please Please help!!! Thanks. I am using access 2003.

Douglas J. Steele said:
You're missing the comma between the SQL statement and the dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a
continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product list].Selection =
0;"
dbFailOnError

End Sub

:

Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can
uncheck
all
checkbox when I click on it. The following code uncheck only the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName =
0;",
dbFailOnError
End Sub
 
D

Douglas J. Steele

Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0",
dbFailOnError
Me.Requery
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

How do I program a requery? There is actually a refresh button that I can
create from the tool bar wizard. But I think it's a hazzle that I have to
keep clicking on the refresh button for every little changes. How come
when
I used the code to select clear all it doesn't refresh by itself instead I
have to use a refresh button to do that.
So the bottom line is I want the system to refresh the changes after I
click
on the clear all or select all button that I created instead of clicking
on
the refresh button contantly. Thank you so much.

Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0;",
dbFailOnError

End Sub

Douglas J. Steele said:
Try issuing a Requery on your form after you run the SQL.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

It's really driving me crazy. In my continues form when I only select
the
first three items check box the last one that I checked will not show
up
when
I click on the query button why is that and vise vera when I uncheck it
the
last one I uncheck shows up as checked on my query. This is driving me
nuts.
Please Please help!!! Thanks. I am using access 2003.

:

You're missing the comma between the SQL statement and the
dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a
continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product
list].Selection =
0;"
dbFailOnError

End Sub

:

Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can
uncheck
all
checkbox when I click on it. The following code uncheck only
the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName =
0;",
dbFailOnError
End Sub
 
G

Guest

Hi Douglas,

The me.requery works but when used it on the "clear all" button it doesn't
clear the last selection. In other words, if I have checked three check
boxes and click on the clear all button the last one does not get cleared.
Only two check boxes gets cleared but the most recent checked box or check
box #3 does not get cleared. This is so weired. Thanks.

Douglas J. Steele said:
Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0",
dbFailOnError
Me.Requery
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

How do I program a requery? There is actually a refresh button that I can
create from the tool bar wizard. But I think it's a hazzle that I have to
keep clicking on the refresh button for every little changes. How come
when
I used the code to select clear all it doesn't refresh by itself instead I
have to use a refresh button to do that.
So the bottom line is I want the system to refresh the changes after I
click
on the clear all or select all button that I created instead of clicking
on
the refresh button contantly. Thank you so much.

Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0;",
dbFailOnError

End Sub

Douglas J. Steele said:
Try issuing a Requery on your form after you run the SQL.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Douglas,

It's really driving me crazy. In my continues form when I only select
the
first three items check box the last one that I checked will not show
up
when
I click on the query button why is that and vise vera when I uncheck it
the
last one I uncheck shows up as checked on my query. This is driving me
nuts.
Please Please help!!! Thanks. I am using access 2003.

:

You're missing the comma between the SQL statement and the
dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a
continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product
list].Selection =
0;"
dbFailOnError

End Sub

:

Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can
uncheck
all
checkbox when I click on it. The following code uncheck only
the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName =
0;",
dbFailOnError
End Sub
 
G

Guest

Hi Douglas,

Thank you for your help. I was able to figure it out. Just create a new
form and then drag the table to the form and it works that way...don't know
why this work and the other way doesn't work. Anyhow, thank you so much for
your help. Really appreciate it.

E-mail report using Lotus Notes rather t said:
Hi Douglas,

The me.requery works but when used it on the "clear all" button it doesn't
clear the last selection. In other words, if I have checked three check
boxes and click on the clear all button the last one does not get cleared.
Only two check boxes gets cleared but the most recent checked box or check
box #3 does not get cleared. This is so weired. Thanks.

Douglas J. Steele said:
Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0",
dbFailOnError
Me.Requery
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
Hi Douglas,

How do I program a requery? There is actually a refresh button that I can
create from the tool bar wizard. But I think it's a hazzle that I have to
keep clicking on the refresh button for every little changes. How come
when
I used the code to select clear all it doesn't refresh by itself instead I
have to use a refresh button to do that.
So the bottom line is I want the system to refresh the changes after I
click
on the clear all or select all button that I created instead of clicking
on
the refresh button contantly. Thank you so much.

Private Sub ClearAll_Click()
CurrentDb.Execute "Update [Productlist] Set [Productlist].Selection = 0;",
dbFailOnError

End Sub

:

Try issuing a Requery on your form after you run the SQL.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Douglas,

It's really driving me crazy. In my continues form when I only select
the
first three items check box the last one that I checked will not show
up
when
I click on the query button why is that and vise vera when I uncheck it
the
last one I uncheck shows up as checked on my query. This is driving me
nuts.
Please Please help!!! Thanks. I am using access 2003.

:

You're missing the comma between the SQL statement and the
dbFailOnError
parameter. (Presumably you've got that on one line in your program)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"E-mail report using Lotus Notes rather t"
message Hi Fredg or anyone,

Can you tell me what I am doing wrong with this code. I have a
continuous
form and I am trying to create a button to clear all checked boxes.

Private Sub Command8_Click()
CurrentDb.Execute "Update [Product list] Set [Product
list].Selection =
0;"
dbFailOnError

End Sub

:

Thanks fredg the code worked

:

On Mon, 10 Jan 2005 08:05:05 -0800, Antonio wrote:

Hello Group,

I'm trying to create a button in a continues form that can
uncheck
all
checkbox when I click on it. The following code uncheck only
the
checkbox
that I'm on. Is there something that I',m over looking?

Private Sub cmdClearCheckBoxes_Click()
Dim ctl As Control
Dim frm As Form
Set frm = Me
For Each ctl In frm.Controls
With ctl
If .ControlType = acCheckBox Then
If ctl.Value = True Then
ctl.Value = False
End If
End If
End With
Next ctl

End Sub

Thanks in advance for your assisting

Is the check box bound to a field in the table?
Private Sub cmdClearCheckBoxes_Click()
CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxName =
0;",
dbFailOnError
End Sub
 

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