Check box help

BenH

Registered User.
Local time
Today, 02:39
Joined
Oct 31, 2008
Messages
25
Hello, first post here and am quite new to this! Have Googled this all morning and can't work it out.

I have a form with unbound controls. I have a text box, with a command button at the end which when clicked loads an Open File dialog, which when used inserts the file path into the text box.

I've added a check box at the end which I want to use to disable of enable the command button. The DefaultValue of the check box has been set to False at Design Time.


Private Sub chkEmptyStarts_AfterUpdate()
'if check box clicked to On, clear text in lblStarts, and disable the 'cmdStarts button
'if check box clicked off, ensure that cmdStarts is enabled
If Me.chkEmptyStarts.Value = True Then
Me.txtStarts = ""
Me.cmdStarts.Enabled = False
ElseIf Me.chkEmptyStarts.Value = False Then
Me.cmdStarts.Enabled = True
End If

This is not working. On Access 2000. Can anyone help?
 
Last edited:
How is it not working? Does nothing? Throws an error message? Is error message, which one? I set up a quick form with your controls/names and it works as you want it to. The only thing I noticed was in the comment line

'if check box clicked to On, clear text in lblStarts, and disable the 'cmdStarts button

Lables don't have "text" but rather a caption. In the code you're clearing txtStarts.

In a bound form you'd have to also place the code in the Form_Current event, but in an unbound form it shouldn't matter.
 
Yes the text im clearing is in the txtStarts, and not the label, I got confused. Will amend the note. When the form loads the check box is not tick, it's white (not greyed). When I click the check box, nothing happens. It kinda flashes then goes back to being blank. The command button is not disabled.
 
Also, interestningly, if I add a brand new check box to the form, and input a default value false, ensure it's enabled, not locked, etc. when I go into the Form view, when I tick it, it does not change. It seems impossible on my form to change the value of the check box by clicking it, but I've read it should do this automatically.
 
Realised that my form's can edit property was set to No.

Doh! Works now.
 
Duh! :o Glad you got it figured out! :D The typical question of this type usually involves comboboxes; when the form can't be edited they will drop down but you can't make a selection from them!
 

Users who are viewing this thread

Back
Top Bottom