Click checkbox with command button

G

Guest

I have a checkbox named [count] and a command button named [update]. I would
like to make the command button set the checkbox to true when clicked. I
have tried these three things but I keep getting a Run time error 2135, this
property is read only and cant be set. What am I doing wrong? The goal of
this is to add a new record for a date and time field that has the Date() and
Time() default values to get a time stamp for the update withouth typing any
information into the record set.

update_on click
me.count = true

update_on click
if isnull (me.count) then
me.count = true
end if

update_on click
if isnull (me.date) then
me.count = true
end if
 
K

Klatuu

Your first problem is you are using reserved words for names. Update and
Count are both Access reserved words and shoul Never be used as names.
Command buttons should start with something like cmd and check boxes with
chk. That way, you know by reading the code what kind of control they are
and there is no possibility of getting it confused with a reserved word.

It should be:

Private Sub cmdUpdate_Click()
Me.chkCount = True
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