Check Box to capture a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would I put a simple unbound check box on the form I am using and build
an event that would enter the current date, now (), in a field called
[actualdate]. I am assuming I would build an after event expression that
would aout enter the current date into the form?
 
TJ

If your checkbox triggers entry of the current date (Date(), not Now()) in a
field (called [actualdate]), does it also "remove" the date from that field?

Is the field [actualdate] bound to the underlying data source, or is it also
unbound?

You could use something like:

If Me.chkCheckBox = True Then
Me.txtActualDate = Date()
Else
Me.txtActualDate = Null
End If

in the check box's AfterUpdate event.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks for the quick response.
The actualdate field is bound to the table.
Does the code you provided go into the code builder in the after event of
the Check38 which is the name of the check box? The form is named Design
Dates, do I replace me with Design Dates?

Jeff Boyce said:
TJ

If your checkbox triggers entry of the current date (Date(), not Now()) in a
field (called [actualdate]), does it also "remove" the date from that field?

Is the field [actualdate] bound to the underlying data source, or is it also
unbound?

You could use something like:

If Me.chkCheckBox = True Then
Me.txtActualDate = Date()
Else
Me.txtActualDate = Null
End If

in the check box's AfterUpdate event.

Regards

Jeff Boyce
Microsoft Office/Access MVP


tjdaly said:
How would I put a simple unbound check box on the form I am using and
build
an event that would enter the current date, now (), in a field called
[actualdate]. I am assuming I would build an after event expression that
would aout enter the current date into the form?
 
TJ

The code example was only an example. You'd need to use your
form's/control's names. Since you want the date box to update when the
checkbox is changed, you'd put it in the AfterUpdate event of the checkbox.

Regards

Jeff Boyce
Microsoft Office/Access MVP


tjdaly said:
Thanks for the quick response.
The actualdate field is bound to the table.
Does the code you provided go into the code builder in the after event of
the Check38 which is the name of the check box? The form is named Design
Dates, do I replace me with Design Dates?

Jeff Boyce said:
TJ

If your checkbox triggers entry of the current date (Date(), not Now())
in a
field (called [actualdate]), does it also "remove" the date from that
field?

Is the field [actualdate] bound to the underlying data source, or is it
also
unbound?

You could use something like:

If Me.chkCheckBox = True Then
Me.txtActualDate = Date()
Else
Me.txtActualDate = Null
End If

in the check box's AfterUpdate event.

Regards

Jeff Boyce
Microsoft Office/Access MVP


tjdaly said:
How would I put a simple unbound check box on the form I am using and
build
an event that would enter the current date, now (), in a field called
[actualdate]. I am assuming I would build an after event expression
that
would aout enter the current date into the form?
 
Jeff,
Thanks for the quick response.
My check box is named check38, should I rename checkbox to check38?
I am assuming this code goes in the code builder in the after event of the
check38?
The form is named Design Dates, do I rename Me to the actual form name?
Thanks again,
TJ

Jeff Boyce said:
TJ

If your checkbox triggers entry of the current date (Date(), not Now()) in a
field (called [actualdate]), does it also "remove" the date from that field?

Is the field [actualdate] bound to the underlying data source, or is it also
unbound?

You could use something like:

If Me.chkCheckBox = True Then
Me.txtActualDate = Date()
Else
Me.txtActualDate = Null
End If

in the check box's AfterUpdate event.

Regards

Jeff Boyce
Microsoft Office/Access MVP


tjdaly said:
How would I put a simple unbound check box on the form I am using and
build
an event that would enter the current date, now (), in a field called
[actualdate]. I am assuming I would build an after event expression that
would aout enter the current date into the form?
 
I go it to work.
Thanks for your help!

Jeff Boyce said:
TJ

The code example was only an example. You'd need to use your
form's/control's names. Since you want the date box to update when the
checkbox is changed, you'd put it in the AfterUpdate event of the checkbox.

Regards

Jeff Boyce
Microsoft Office/Access MVP


tjdaly said:
Thanks for the quick response.
The actualdate field is bound to the table.
Does the code you provided go into the code builder in the after event of
the Check38 which is the name of the check box? The form is named Design
Dates, do I replace me with Design Dates?

Jeff Boyce said:
TJ

If your checkbox triggers entry of the current date (Date(), not Now())
in a
field (called [actualdate]), does it also "remove" the date from that
field?

Is the field [actualdate] bound to the underlying data source, or is it
also
unbound?

You could use something like:

If Me.chkCheckBox = True Then
Me.txtActualDate = Date()
Else
Me.txtActualDate = Null
End If

in the check box's AfterUpdate event.

Regards

Jeff Boyce
Microsoft Office/Access MVP


How would I put a simple unbound check box on the form I am using and
build
an event that would enter the current date, now (), in a field called
[actualdate]. I am assuming I would build an after event expression
that
would aout enter the current date into the form?
 
Back
Top