Checkbox Query...

katie george

New member
Local time
Today, 11:23
Joined
Apr 13, 2004
Messages
7
Hi -

Please could someone give me some help on the following..

I have a form with the following fields

extended warranty (yes/no checkbox)
start date
end date

I would like to be able to code this such that the start and end date text boxes are only visible and enabled when the user selects yes to extended warranty. Therefore being invisible if the user does not check the box or unchecks it.

I have been trying various bits of code but am not very experienced with Access and keep coming across problems. Hope that this makes sense, many thanks in advance

Katie
 
Assumed Names:

chkWarranty (checkbox)
txtStartDate (textbox)
txtEndDate (textbox)


Code:
Private Sub Form_Current()
    If Me.chkWarranty Then
        Me.txtStartDate.Enabled = True
        Me.txtEndDate.Enabled = True
    Else
        Me.txtStartDate.Enabled = False
        Me.txtEndDate.Enabled = False
    End If
End Sub

Code:
Private Sub chkWarranty_AfterUpdate()
    Call Form_Current
End Sub
 
Last edited:
you can try something in the afterupdate event of your checkbox:

Code:
if me.checkboxname  = true then
me.startdatename.visible = true
me.enddatename.visible = true
else
me.startdatename.visible = false
me.enddatename.visible = false
end if
 

Users who are viewing this thread

Back
Top Bottom