By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,192 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,192 IT Pros & Developers. It's quick & easy.

Tick Box as Date Field

P: n/a
I have tickbox on a form, and I would like to use a date field as the
control source.

i.e. I would like to have it display as ticked when a date exists in
the field, and vice versa.

Also, when it is either checked or unchecked, I would like it to stamp
todays date or remove the date from the control source. I can see how
to do this if there are seperate fields for the checkbox and date, but
I would like to combine them into one field if possible.

Thanks in advance for any help!!!

Jan 4 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 4 Jan 2007 05:43:52 -0800, "andrewbda" <an*******@gmail.comwrote:

You need only a single date field in your table. The field could be
"displayed" in an eventually hidden but for debug purposes visible
textbox. Then you create an unbound checkbox, and set its
controlsource to:
=Not Isnull(<your_date_field>)

-Tom.

>I have tickbox on a form, and I would like to use a date field as the
control source.

i.e. I would like to have it display as ticked when a date exists in
the field, and vice versa.

Also, when it is either checked or unchecked, I would like it to stamp
todays date or remove the date from the control source. I can see how
to do this if there are seperate fields for the checkbox and date, but
I would like to combine them into one field if possible.

Thanks in advance for any help!!!
Jan 4 '07 #2

P: n/a
Thanks,

I know how to have the checkbox indicate whether there is data in the
field or not, but I would also like it ot be able to insert/delete the
date when ticked/unticked, this is the part I am having trouble with.

Will " =Not Isnull(<your_date_field>)" accomplish this?
Tom van Stiphout wrote:
On 4 Jan 2007 05:43:52 -0800, "andrewbda" <an*******@gmail.comwrote:

You need only a single date field in your table. The field could be
"displayed" in an eventually hidden but for debug purposes visible
textbox. Then you create an unbound checkbox, and set its
controlsource to:
=Not Isnull(<your_date_field>)

-Tom.

I have tickbox on a form, and I would like to use a date field as the
control source.

i.e. I would like to have it display as ticked when a date exists in
the field, and vice versa.

Also, when it is either checked or unchecked, I would like it to stamp
todays date or remove the date from the control source. I can see how
to do this if there are seperate fields for the checkbox and date, but
I would like to combine them into one field if possible.

Thanks in advance for any help!!!
Jan 4 '07 #3

P: n/a
"andrewbda" <an*******@gmail.comwrote in message
news:11**********************@s80g2000cwa.googlegr oups.com...
>I have tickbox on a form, and I would like to use a date field as the
control source.

i.e. I would like to have it display as ticked when a date exists in
the field, and vice versa.

Also, when it is either checked or unchecked, I would like it to stamp
todays date or remove the date from the control source. I can see how
to do this if there are seperate fields for the checkbox and date, but
I would like to combine them into one field if possible.

Thanks in advance for any help!!!
If you have a text box on your form which is bound to your date field then
you could then use If ... Then clauses in the form's Current event to test
for the presence of data and populate your check box accordingly.
Similarly, you could have code in the check box's update event to influence
the contents of the text box. Untested, but should get you started:

Form Current event:

If IsNull(Me.txtDate) Then
Me.chkDate = 0
Else
Me.chkDate = -1
End If

Check box Update event:

If Me.chkDate Then
Me.txtDate = Date()
Else
Me.txtDate = Null
End If
Me.Refresh

HTH - Keith.
www.keithwilby.com
Jan 4 '07 #4

P: n/a
On 4 Jan 2007 06:19:42 -0800, "andrewbda" <an*******@gmail.comwrote:

No it won't. That expression only sets the value of the checkbox based
on whether there is a date or not.
If you want check/uncheck to set/clear the current date, I would write
my code in the <checkbox>_AfterUpdate event:
if Me.<checkbox= True then
Me.<your_date_field= Date()
else
Me.<your_date_field= Null
end if

-Tom.

>Thanks,

I know how to have the checkbox indicate whether there is data in the
field or not, but I would also like it ot be able to insert/delete the
date when ticked/unticked, this is the part I am having trouble with.

Will " =Not Isnull(<your_date_field>)" accomplish this?
Tom van Stiphout wrote:
>On 4 Jan 2007 05:43:52 -0800, "andrewbda" <an*******@gmail.comwrote:

You need only a single date field in your table. The field could be
"displayed" in an eventually hidden but for debug purposes visible
textbox. Then you create an unbound checkbox, and set its
controlsource to:
=Not Isnull(<your_date_field>)

-Tom.

>I have tickbox on a form, and I would like to use a date field as the
control source.

i.e. I would like to have it display as ticked when a date exists in
the field, and vice versa.

Also, when it is either checked or unchecked, I would like it to stamp
todays date or remove the date from the control source. I can see how
to do this if there are seperate fields for the checkbox and date, but
I would like to combine them into one field if possible.

Thanks in advance for any help!!!
Jan 5 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.