Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unchecking a check box 4

Status
Not open for further replies.

JSD

Technical User
Jan 18, 2002
189
0
0
US
Hello

I am trying to uncheck a check box in a table in the OnClose event of a form. MS Access help was no help. I am thankful for any suggestions.

Jeremy
 
In the onclose event set the value of the field to -1 (yes)

I think it would be something like this

me.[fieldname].value = -1

If your form is set to continuous forms, I think you might have a problem in that it will set all records to yes. I believe the form should be set to single form.

I hope I have helped.

Dawn

 
You can also use True or False to set the value in a checkbox

True = checked
False = unchecked

nameOfcheckbox.value = True | False
 
I can't get that to work in a global module. My code is:

Code:
Forms!frmTestReport.chkScanned.Value = True

I keep getting the error Application-defined or object-defined error.

I have the same set up with a series of textboxes and it appears to work fine with them, what's the deal with the checkbox?
 
Hi,

I have something similiar to the previous posting, the following is in a class module of a form:

Code:
With Forms!frmForm1
  .chkMyCheck.Value = True

I get the error "you cannot assign a value to this object".
I was expecting to use the Checked property of the checkbox, but there is no such thing in VBA.

Please help, this is my 2nd month into VBA, and so far I must say it's been quite fun - and the fun should not become frustrations :)
 
Striker73 and Jean2002...

The code each of you has written should work. Make sure the form is open when the code is running.


Randy
 
Randy,

you were right, the form was not open. Thanks!
 
Also . . . . since the data in a CheckBox [blue]defaults to Value[/blue], its not needed:

[purple]Forms!frmTestReport.chkScanned = True[/purple]


Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top