PC Review


Reply
Thread Tools Rate Thread

Auto Date for check boxes

 
 
Tammy S.
Guest
Posts: n/a
 
      16th Dec 2009
I have check boxes and a date field for each box. When the box is checked,
I'd like to corresponding date field to automatically enter the current date.
How can I do this?
 
Reply With Quote
 
 
 
 
Al Campagna
Guest
Posts: n/a
 
      16th Dec 2009
Tammy,
What happens when the checkbox is unchecked (False)?
I'll assume you want the date field nulled out...

Use the AfterUpdate event of your checkbox (ex. chkExample) to
update the date field (ex. ExampleDate) (you use your own object names)

Private Sub chkExample_AfterUpdate()
If chkExample = True
ExampleDate = Date()
Else
ExampleDate = Null
End If
End Sub

Note: If you need the Date and Time in ExampleDate, use...
ExampleDate = Now()
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Tammy S." <(E-Mail Removed)> wrote in message
news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
>I have check boxes and a date field for each box. When the box is checked,
> I'd like to corresponding date field to automatically enter the current
> date.
> How can I do this?



 
Reply With Quote
 
dafe
Guest
Posts: n/a
 
      16th Dec 2009


"Tammy S." <(E-Mail Removed)> wrote in message
news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
> I have check boxes and a date field for each box. When the box is
> checked,
> I'd like to corresponding date field to automatically enter the current
> date.
> How can I do this?


 
Reply With Quote
 
Tammy S.
Guest
Posts: n/a
 
      16th Dec 2009
I'm getting an compile error: Expected: Then or GoTo. I have used the
underscore key between filed names that have more than one word. Could this
be causing the problem?

Example: EFIT_Confirmed is the check box and the corresponding date is
Date_Confirmed

"Al Campagna" wrote:

> Tammy,
> What happens when the checkbox is unchecked (False)?
> I'll assume you want the date field nulled out...
>
> Use the AfterUpdate event of your checkbox (ex. chkExample) to
> update the date field (ex. ExampleDate) (you use your own object names)
>
> Private Sub chkExample_AfterUpdate()
> If chkExample = True
> ExampleDate = Date()
> Else
> ExampleDate = Null
> End If
> End Sub
>
> Note: If you need the Date and Time in ExampleDate, use...
> ExampleDate = Now()
> --
> hth
> Al Campagna
> Microsoft Access MVP
> http://home.comcast.net/~cccsolutions/index.html
>
> "Find a job that you love... and you'll never work a day in your life."
>
> "Tammy S." <(E-Mail Removed)> wrote in message
> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
> >I have check boxes and a date field for each box. When the box is checked,
> > I'd like to corresponding date field to automatically enter the current
> > date.
> > How can I do this?

>
>
> .
>

 
Reply With Quote
 
Al Campagna
Guest
Posts: n/a
 
      16th Dec 2009
Tammy,
Re: using "_" instead of spaces in object names is just fine.
I think it's just my typo... mea culpa.
Try this... (notice the added Then)

Private Sub chkExample_AfterUpdate()
If chkExample = True Then
ExampleDate = Date()
Else
ExampleDate = Null
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"Tammy S." <(E-Mail Removed)> wrote in message
news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
> I'm getting an compile error: Expected: Then or GoTo. I have used the
> underscore key between filed names that have more than one word. Could
> this
> be causing the problem?
>
> Example: EFIT_Confirmed is the check box and the corresponding date is
> Date_Confirmed
>
> "Al Campagna" wrote:
>
>> Tammy,
>> What happens when the checkbox is unchecked (False)?
>> I'll assume you want the date field nulled out...
>>
>> Use the AfterUpdate event of your checkbox (ex. chkExample) to
>> update the date field (ex. ExampleDate) (you use your own object names)
>>
>> Private Sub chkExample_AfterUpdate()
>> If chkExample = True
>> ExampleDate = Date()
>> Else
>> ExampleDate = Null
>> End If
>> End Sub
>>
>> Note: If you need the Date and Time in ExampleDate, use...
>> ExampleDate = Now()
>> --
>> hth
>> Al Campagna
>> Microsoft Access MVP
>> http://home.comcast.net/~cccsolutions/index.html
>>
>> "Find a job that you love... and you'll never work a day in your
>> life."
>>
>> "Tammy S." <(E-Mail Removed)> wrote in message
>> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
>> >I have check boxes and a date field for each box. When the box is
>> >checked,
>> > I'd like to corresponding date field to automatically enter the current
>> > date.
>> > How can I do this?

>>
>>
>> .
>>



 
Reply With Quote
 
Tammy S.
Guest
Posts: n/a
 
      17th Dec 2009
Okay, got it in, shows up in all corresponding fields (check box and date
box), but the parenthesis after = Date keep disappearing.

"Al Campagna" wrote:

> Tammy,
> Re: using "_" instead of spaces in object names is just fine.
> I think it's just my typo... mea culpa.
> Try this... (notice the added Then)
>
> Private Sub chkExample_AfterUpdate()
> If chkExample = True Then
> ExampleDate = Date()
> Else
> ExampleDate = Null
> End If
> End Sub
> --
> hth
> Al Campagna
> Microsoft Access MVP
> http://home.comcast.net/~cccsolutions/index.html
>
> "Find a job that you love... and you'll never work a day in your life."
>
>
> "Tammy S." <(E-Mail Removed)> wrote in message
> news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
> > I'm getting an compile error: Expected: Then or GoTo. I have used the
> > underscore key between filed names that have more than one word. Could
> > this
> > be causing the problem?
> >
> > Example: EFIT_Confirmed is the check box and the corresponding date is
> > Date_Confirmed
> >
> > "Al Campagna" wrote:
> >
> >> Tammy,
> >> What happens when the checkbox is unchecked (False)?
> >> I'll assume you want the date field nulled out...
> >>
> >> Use the AfterUpdate event of your checkbox (ex. chkExample) to
> >> update the date field (ex. ExampleDate) (you use your own object names)
> >>
> >> Private Sub chkExample_AfterUpdate()
> >> If chkExample = True
> >> ExampleDate = Date()
> >> Else
> >> ExampleDate = Null
> >> End If
> >> End Sub
> >>
> >> Note: If you need the Date and Time in ExampleDate, use...
> >> ExampleDate = Now()
> >> --
> >> hth
> >> Al Campagna
> >> Microsoft Access MVP
> >> http://home.comcast.net/~cccsolutions/index.html
> >>
> >> "Find a job that you love... and you'll never work a day in your
> >> life."
> >>
> >> "Tammy S." <(E-Mail Removed)> wrote in message
> >> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
> >> >I have check boxes and a date field for each box. When the box is
> >> >checked,
> >> > I'd like to corresponding date field to automatically enter the current
> >> > date.
> >> > How can I do this?
> >>
> >>
> >> .
> >>

>
>
> .
>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      17th Dec 2009
Yeah, that happens. As long as it continues to work, don't worry about it.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Tammy S. wrote:
> Okay, got it in, shows up in all corresponding fields (check box and date
> box), but the parenthesis after = Date keep disappearing.
>
> "Al Campagna" wrote:
>
>> Tammy,
>> Re: using "_" instead of spaces in object names is just fine.
>> I think it's just my typo... mea culpa.
>> Try this... (notice the added Then)
>>
>> Private Sub chkExample_AfterUpdate()
>> If chkExample = True Then
>> ExampleDate = Date()
>> Else
>> ExampleDate = Null
>> End If
>> End Sub
>> --
>> hth
>> Al Campagna
>> Microsoft Access MVP
>> http://home.comcast.net/~cccsolutions/index.html
>>
>> "Find a job that you love... and you'll never work a day in your life."
>>
>>
>> "Tammy S." <(E-Mail Removed)> wrote in message
>> news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
>>> I'm getting an compile error: Expected: Then or GoTo. I have used the
>>> underscore key between filed names that have more than one word. Could
>>> this
>>> be causing the problem?
>>>
>>> Example: EFIT_Confirmed is the check box and the corresponding date is
>>> Date_Confirmed
>>>
>>> "Al Campagna" wrote:
>>>
>>>> Tammy,
>>>> What happens when the checkbox is unchecked (False)?
>>>> I'll assume you want the date field nulled out...
>>>>
>>>> Use the AfterUpdate event of your checkbox (ex. chkExample) to
>>>> update the date field (ex. ExampleDate) (you use your own object names)
>>>>
>>>> Private Sub chkExample_AfterUpdate()
>>>> If chkExample = True
>>>> ExampleDate = Date()
>>>> Else
>>>> ExampleDate = Null
>>>> End If
>>>> End Sub
>>>>
>>>> Note: If you need the Date and Time in ExampleDate, use...
>>>> ExampleDate = Now()
>>>> --
>>>> hth
>>>> Al Campagna
>>>> Microsoft Access MVP
>>>> http://home.comcast.net/~cccsolutions/index.html
>>>>
>>>> "Find a job that you love... and you'll never work a day in your
>>>> life."
>>>>
>>>> "Tammy S." <(E-Mail Removed)> wrote in message
>>>> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
>>>>> I have check boxes and a date field for each box. When the box is
>>>>> checked,
>>>>> I'd like to corresponding date field to automatically enter the current
>>>>> date.
>>>>> How can I do this?
>>>>
>>>> .
>>>>

>>
>> .
>>

 
Reply With Quote
 
Duane Hookom
Guest
Posts: n/a
 
      17th Dec 2009
The () disappearance in a module is normal. Don't worry about it. This is one
of the reasons you should never name a field or control "Date".
--
Duane Hookom
Microsoft Access MVP


"Tammy S." wrote:

> Okay, got it in, shows up in all corresponding fields (check box and date
> box), but the parenthesis after = Date keep disappearing.
>
> "Al Campagna" wrote:
>
> > Tammy,
> > Re: using "_" instead of spaces in object names is just fine.
> > I think it's just my typo... mea culpa.
> > Try this... (notice the added Then)
> >
> > Private Sub chkExample_AfterUpdate()
> > If chkExample = True Then
> > ExampleDate = Date()
> > Else
> > ExampleDate = Null
> > End If
> > End Sub
> > --
> > hth
> > Al Campagna
> > Microsoft Access MVP
> > http://home.comcast.net/~cccsolutions/index.html
> >
> > "Find a job that you love... and you'll never work a day in your life."
> >
> >
> > "Tammy S." <(E-Mail Removed)> wrote in message
> > news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
> > > I'm getting an compile error: Expected: Then or GoTo. I have used the
> > > underscore key between filed names that have more than one word. Could
> > > this
> > > be causing the problem?
> > >
> > > Example: EFIT_Confirmed is the check box and the corresponding date is
> > > Date_Confirmed
> > >
> > > "Al Campagna" wrote:
> > >
> > >> Tammy,
> > >> What happens when the checkbox is unchecked (False)?
> > >> I'll assume you want the date field nulled out...
> > >>
> > >> Use the AfterUpdate event of your checkbox (ex. chkExample) to
> > >> update the date field (ex. ExampleDate) (you use your own object names)
> > >>
> > >> Private Sub chkExample_AfterUpdate()
> > >> If chkExample = True
> > >> ExampleDate = Date()
> > >> Else
> > >> ExampleDate = Null
> > >> End If
> > >> End Sub
> > >>
> > >> Note: If you need the Date and Time in ExampleDate, use...
> > >> ExampleDate = Now()
> > >> --
> > >> hth
> > >> Al Campagna
> > >> Microsoft Access MVP
> > >> http://home.comcast.net/~cccsolutions/index.html
> > >>
> > >> "Find a job that you love... and you'll never work a day in your
> > >> life."
> > >>
> > >> "Tammy S." <(E-Mail Removed)> wrote in message
> > >> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
> > >> >I have check boxes and a date field for each box. When the box is
> > >> >checked,
> > >> > I'd like to corresponding date field to automatically enter the current
> > >> > date.
> > >> > How can I do this?
> > >>
> > >>
> > >> .
> > >>

> >
> >
> > .
> >

 
Reply With Quote
 
Tammy S.
Guest
Posts: n/a
 
      17th Dec 2009
It doesn't work.

"John Spencer" wrote:

> Yeah, that happens. As long as it continues to work, don't worry about it.
>
> John Spencer
> Access MVP 2002-2005, 2007-2009
> The Hilltop Institute
> University of Maryland Baltimore County
>
> Tammy S. wrote:
> > Okay, got it in, shows up in all corresponding fields (check box and date
> > box), but the parenthesis after = Date keep disappearing.
> >
> > "Al Campagna" wrote:
> >
> >> Tammy,
> >> Re: using "_" instead of spaces in object names is just fine.
> >> I think it's just my typo... mea culpa.
> >> Try this... (notice the added Then)
> >>
> >> Private Sub chkExample_AfterUpdate()
> >> If chkExample = True Then
> >> ExampleDate = Date()
> >> Else
> >> ExampleDate = Null
> >> End If
> >> End Sub
> >> --
> >> hth
> >> Al Campagna
> >> Microsoft Access MVP
> >> http://home.comcast.net/~cccsolutions/index.html
> >>
> >> "Find a job that you love... and you'll never work a day in your life."
> >>
> >>
> >> "Tammy S." <(E-Mail Removed)> wrote in message
> >> news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
> >>> I'm getting an compile error: Expected: Then or GoTo. I have used the
> >>> underscore key between filed names that have more than one word. Could
> >>> this
> >>> be causing the problem?
> >>>
> >>> Example: EFIT_Confirmed is the check box and the corresponding date is
> >>> Date_Confirmed
> >>>
> >>> "Al Campagna" wrote:
> >>>
> >>>> Tammy,
> >>>> What happens when the checkbox is unchecked (False)?
> >>>> I'll assume you want the date field nulled out...
> >>>>
> >>>> Use the AfterUpdate event of your checkbox (ex. chkExample) to
> >>>> update the date field (ex. ExampleDate) (you use your own object names)
> >>>>
> >>>> Private Sub chkExample_AfterUpdate()
> >>>> If chkExample = True
> >>>> ExampleDate = Date()
> >>>> Else
> >>>> ExampleDate = Null
> >>>> End If
> >>>> End Sub
> >>>>
> >>>> Note: If you need the Date and Time in ExampleDate, use...
> >>>> ExampleDate = Now()
> >>>> --
> >>>> hth
> >>>> Al Campagna
> >>>> Microsoft Access MVP
> >>>> http://home.comcast.net/~cccsolutions/index.html
> >>>>
> >>>> "Find a job that you love... and you'll never work a day in your
> >>>> life."
> >>>>
> >>>> "Tammy S." <(E-Mail Removed)> wrote in message
> >>>> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
> >>>>> I have check boxes and a date field for each box. When the box is
> >>>>> checked,
> >>>>> I'd like to corresponding date field to automatically enter the current
> >>>>> date.
> >>>>> How can I do this?
> >>>>
> >>>> .
> >>>>
> >>
> >> .
> >>

> .
>

 
Reply With Quote
 
Al Campagna
Guest
Posts: n/a
 
      17th Dec 2009

"Tammy S." <(E-Mail Removed)> wrote in message
news:5D428741-7593-4234-AB4D-(E-Mail Removed)...
> It doesn't work.
>
> "John Spencer" wrote:
>
>> Yeah, that happens. As long as it continues to work, don't worry about
>> it.
>>
>> John Spencer
>> Access MVP 2002-2005, 2007-2009
>> The Hilltop Institute
>> University of Maryland Baltimore County
>>
>> Tammy S. wrote:
>> > Okay, got it in, shows up in all corresponding fields (check box and
>> > date
>> > box), but the parenthesis after = Date keep disappearing.
>> >
>> > "Al Campagna" wrote:
>> >
>> >> Tammy,
>> >> Re: using "_" instead of spaces in object names is just fine.
>> >> I think it's just my typo... mea culpa.
>> >> Try this... (notice the added Then)
>> >>
>> >> Private Sub chkExample_AfterUpdate()
>> >> If chkExample = True Then
>> >> ExampleDate = Date()
>> >> Else
>> >> ExampleDate = Null
>> >> End If
>> >> End Sub
>> >> --
>> >> hth
>> >> Al Campagna
>> >> Microsoft Access MVP
>> >> http://home.comcast.net/~cccsolutions/index.html
>> >>
>> >> "Find a job that you love... and you'll never work a day in your
>> >> life."
>> >>
>> >>
>> >> "Tammy S." <(E-Mail Removed)> wrote in message
>> >> news:031B4C46-4810-4CDA-AF48-(E-Mail Removed)...
>> >>> I'm getting an compile error: Expected: Then or GoTo. I have used
>> >>> the
>> >>> underscore key between filed names that have more than one word.
>> >>> Could
>> >>> this
>> >>> be causing the problem?
>> >>>
>> >>> Example: EFIT_Confirmed is the check box and the corresponding date
>> >>> is
>> >>> Date_Confirmed
>> >>>
>> >>> "Al Campagna" wrote:
>> >>>
>> >>>> Tammy,
>> >>>> What happens when the checkbox is unchecked (False)?
>> >>>> I'll assume you want the date field nulled out...
>> >>>>
>> >>>> Use the AfterUpdate event of your checkbox (ex. chkExample) to
>> >>>> update the date field (ex. ExampleDate) (you use your own object
>> >>>> names)
>> >>>>
>> >>>> Private Sub chkExample_AfterUpdate()
>> >>>> If chkExample = True
>> >>>> ExampleDate = Date()
>> >>>> Else
>> >>>> ExampleDate = Null
>> >>>> End If
>> >>>> End Sub
>> >>>>
>> >>>> Note: If you need the Date and Time in ExampleDate, use...
>> >>>> ExampleDate = Now()
>> >>>> --
>> >>>> hth
>> >>>> Al Campagna
>> >>>> Microsoft Access MVP
>> >>>> http://home.comcast.net/~cccsolutions/index.html
>> >>>>
>> >>>> "Find a job that you love... and you'll never work a day in your
>> >>>> life."
>> >>>>
>> >>>> "Tammy S." <(E-Mail Removed)> wrote in message
>> >>>> news:F3AE64D4-0068-4B21-A6D5-(E-Mail Removed)...
>> >>>>> I have check boxes and a date field for each box. When the box is
>> >>>>> checked,
>> >>>>> I'd like to corresponding date field to automatically enter the
>> >>>>> current
>> >>>>> date.
>> >>>>> How can I do this?
>> >>>>
>> >>>> .
>> >>>>
>> >>
>> >> .
>> >>

>> .
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Assign Check boxes sixhobbits Microsoft Excel Discussion 10 19th Aug 2010 12:40 AM
Auto Check/Uncheck boxes based on checking 1 of 30 boxes Steve Stad Microsoft Access VBA Modules 8 24th May 2010 01:26 PM
Check boxes - when one box is checked, I want a 2nd box to auto ch =?Utf-8?B?UnVzc2VsbC1zdGFuZWx5?= Microsoft Excel Misc 2 1st Jul 2005 08:52 PM
Auto-unchecking check boxes... DubboPete Microsoft Access Forms 2 28th May 2004 12:25 PM
Check Boxes - auto clearing them MikeGDOL Microsoft Excel Worksheet Functions 0 7th Oct 2003 07:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 PM.