Check Box 'Date Confirmed'

battenberg

Burning candles both ends
Local time
Today, 11:35
Joined
Sep 25, 2006
Messages
118
Hi

I want to tick a check box next to a [date] field on a form which signifies 'date confirmed'

on clicking the check box, I'd like the [date] field to be greyed out/locked/font colour changed etc...

any thoughts on how to do it???

Thanks
 
Write some code on the check boxes on click event to lock the control that the date is displayed in.
 
You can use a simple If...Then statement on the "On Click" event of the checkbox.

Private Sub Checkbox1_Click()
If Me.Checkbox1 = True Then
Me.Textbox1.Enabled = False
ElseIf Me.Checkbox1 = False Then
Me.Textbox1.Enabled = True

End If

End Sub

PS...... Depending on how you set this up... You might find you need the same statement on the "On Open" event of the form.
 
thanks for the input.

I've been puzzled as to how i can lock/unlock (or whatever...) the control on each record as I navigate through.

Will the 'on open' event reset for each individual record?

I have been playing with this and need the record locked or unlocked on a 'per record' basis not on a per 'form basis'

thanks again...

PS. I have now added a boolean field to the table to attempt to handle this
 
Last edited:
If you put some code in the OnCurrent even, to do almost exactly the same as it does when you click the tick box, it should check it for every record.
i.e. Put the following code into the OnCurrent event of the form:

Private Sub Form1_Current()
If Me.Checkbox1 = True Then
Me.Textbox1.Enabled = False
ElseIf Me.Checkbox1 = False Then
Me.Textbox1.Enabled = True

End If

End Sub

This should just look at the check box, if it is ticked blank the text box, if not leave the text box open. You can alter the code then to do other things as you need to, but by using the OnCurrent event it will be for every single record. Hope this helps
 
out of interest

enabled and locked work together

enabled true locked false normal
enabled true locked true you can enter the fieldm but not change it
si you can sort on it, eg

enabled false locked true can't think - enabled false stops you using the field, locked does nothing

BUT
enabled false locked false greys the field
 
a big thanks to CEH & agehoops for the code...
and thankyou all for your input...:)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom