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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Update a date/time control when check box control is updated
Thanks Dave, I should have remembered that one.
|
#4
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|