A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update a date/time control when check box control is updated



 
 
Thread Tools Display Modes
  #1  
Old February 15th, 2008, 05:41 PM posted to microsoft.public.access.forms
BrianP
external usenet poster
 
Posts: 18
Default Update a date/time control when check box control is updated

I have two columns in tbl.Jobs. One field is a bit data type that I named
Jobs.OnHold and the control on the form is a check box. I also have a
date/time field named HoldDate. I want the hold date field to automatically
udpate with the current date everytime the check box control is udpated. What
is the best way to accomplish this?
  #2  
Old February 15th, 2008, 06:26 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Update a date/time control when check box control is updated

Use the After Update event of the check box control:

Me.txtHoldDate = Date

--
Dave Hargis, Microsoft Access MVP


"BrianP" wrote:

I have two columns in tbl.Jobs. One field is a bit data type that I named
Jobs.OnHold and the control on the form is a check box. I also have a
date/time field named HoldDate. I want the hold date field to automatically
udpate with the current date everytime the check box control is udpated. What
is the best way to accomplish this?

  #3  
Old February 15th, 2008, 11:40 PM posted to microsoft.public.access.forms
BrianP
external usenet poster
 
Posts: 18
Default Update a date/time control when check box control is updated

Thanks Dave, I should have remembered that one.

  #4  
Old February 16th, 2008, 09:53 PM posted to microsoft.public.access.forms
MaryB
external usenet poster
 
Posts: 6
Default Update a date/time control when check box control is updated

I have a similar question. I have a field called "Sold" which is a check box.
When I check it I want the field "Date of Sale" to automatically fill in
with todays date. I understand going to the "after update event" but I don't
know what code to write.
Hope you can help. Thank you

"Klatuu" wrote:

Use the After Update event of the check box control:

Me.txtHoldDate = Date

--
Dave Hargis, Microsoft Access MVP


"BrianP" wrote:

I have two columns in tbl.Jobs. One field is a bit data type that I named
Jobs.OnHold and the control on the form is a check box. I also have a
date/time field named HoldDate. I want the hold date field to automatically
udpate with the current date everytime the check box control is udpated. What
is the best way to accomplish this?

  #5  
Old February 16th, 2008, 10:01 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Update a date/time control when check box control is updated

When you say field, we need to qualify that. Forms don't have fields, they
have controls. Tables and queries have fields. So, to answer your question,
assuming Sold and Date Of Sale are actually controls on your form, it would
be:

Private Sub Sold_AfterUpdate()
If Me.Sold = True Then
Me.[Date Of Sale] = Date
End If
End Sub

If you posted field named instead of control names, use the names of the
controls the fields are bound to. Note the brackets [] around Date Of Sale.
That is necessary because you used spaces in a name. Names should not have
spaces or any other special characters. They should contain only letters,
numbers, and the underscore character. They should also not be Access
reserved names like Date, Time, Name, Description, Year, Month, Day, etc.

Being careful about your naming will save you a lot of headaches.
--
Dave Hargis, Microsoft Access MVP


"maryb" wrote:

I have a similar question. I have a field called "Sold" which is a check box.
When I check it I want the field "Date of Sale" to automatically fill in
with todays date. I understand going to the "after update event" but I don't
know what code to write.
Hope you can help. Thank you

"Klatuu" wrote:

Use the After Update event of the check box control:

Me.txtHoldDate = Date

--
Dave Hargis, Microsoft Access MVP


"BrianP" wrote:

I have two columns in tbl.Jobs. One field is a bit data type that I named
Jobs.OnHold and the control on the form is a check box. I also have a
date/time field named HoldDate. I want the hold date field to automatically
udpate with the current date everytime the check box control is udpated. What
is the best way to accomplish this?

  #6  
Old April 10th, 2008, 04:49 PM posted to microsoft.public.access.forms
Doug Shatto
external usenet poster
 
Posts: 1
Default Update a date/time control when check box is updated

Dave,

I have the following code in a form of my database that is similar to that posted below but it is not updating the date control. Any help is appreciated.

Private Sub Returned_AfterUpdate()

If Me.Returned = True Then
Me.Return_date = Date
End If


End Sub

  #7  
Old April 10th, 2008, 05:04 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Update a date/time control when check box is updated

Is Returned a check box?
That is the only way it would work.
If it is a check box and it is not updating the control, then either you
have some corruption in the form or there is something else happening.
--
Dave Hargis, Microsoft Access MVP


"Doug Shatto" wrote:

Dave,

I have the following code in a form of my database that is similar to that posted below but it is not updating the date control. Any help is appreciated.

Private Sub Returned_AfterUpdate()

If Me.Returned = True Then
Me.Return_date = Date
End If


End Sub


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.