Date updaye - Automatic ???

prabhus

Registered User.
Local time
Yesterday, 22:02
Joined
Mar 14, 2012
Messages
67
In my Access form, users update 4 checkboxs when their work is completed, when this 4 boxed checked then the 5th checkbox will check automatically using afterupdate.
Now i have added the 6 the column with date completed, here i want the date to be updated automatically when the 5th column is checked automatically. how to do it? :banghead:
 
if the user is inserting a new record just set the default value in the table to date() or now() for a date or date/time respectively

if the user is updating an existing record then in the form before update event put the following code:

Code:
me!mydate=date()
or
me!mydate=now()

change names to suit
 
Use the 5th Checkbox AfterUpdate event?
Code:
Private Sub CheckBox6_AfterUpdate()
    Me.dateTextbox = Date()
End Sub
 
Private Sub check110_After Update(Cancel As Integer)
If Me.Check110 = "Yes" Then
Me.Text125 = Now()
End If
End Sub

I tried like above but it was not working.

and For check 110, input is automatic. i.e. user check field 107,108,109 then 110 will be updated automatically. I have used afterupdate in 107,108,109 update last in 110.
how to fix it. I need the date in text125 only when 110 is checked automatically.
 
AfterUpdate of a control is triggered by the control loosing focus. If you assign values to a control by code, AfterUpdate does not get triggered automatically, you need to call it explicitly.

Your code should take into account the fact that people make mistakes, so that if nthe users changes his mind and an item is unticked, the values of all the controls are set appropriately in that case too.
 
Also this iline is wrong

If Me.Check110 = "Yes" Then

it should be

If Me.Check110 = Yes Then 'or True or -1
 
AfterUpdate of a control is triggered by the control loosing focus. If you assign values to a control by code, AfterUpdate does not get triggered automatically, you need to call it explicitly.

Your code should take into account the fact that people make mistakes, so that if nthe users changes his mind and an item is unticked, the values of all the controls are set appropriately in that case too.

Hi, you are right, i tried and i get the dates when i check the box. but when i uncheck the box the date is not disappearing, is there any way to fix this.
 
Breaking my head

Private Sub Updatelast()
Me.Check110 = Me.Check88 And Me.Check90 And Me.Check92 And Me.Check94 And Me.Check96 And Me.Check98 And Me.Check100 And Me.Check102 And Me.Check104 And Me.Check106 And Me.Check108
End Sub

this is my code. I have used afterupdate in all the checks from 88 to 108, when the user checks all the boxes, Check 110 will update automatically using Update last. Until this its perfectly working. Until the user check all the boxes, check 110 will not get checked.
User can't update check110 manually, its locked
Now i have added another field and when check110 updated automatically, i want the date to display, if the check 110 deselected, the date should be removed. is it possible?

i tried the below code, but not working
but i think the event i have selected is wrong, i dont know what else to use.
Private Sub Check110_Click()
If (Me!Check110 = "Yes" Or "True" Or "-1") Then
Me!Text125 = Date
Else
Me!Text125 = Null
End If
End Sub

Any help, highly appreciated!!!
 
you need to understand what the values are - you have not using what I suggested.

check110 is a check box which has one of two values expressed as true or false, yes or no or -1 or 0

It is not a text box

so you can use

If Me.Check110 = Yes Then

or you can use

If Me.Check110 = True Then

or you can use

If Me.Check110 = -1 Then

Note the absence of quotation marks
 
Thank you CJ, i tried as you said, but its not working.
Check 110 is auto update, in this case for the date update, which event should i use?
 
per my original post - the form before update event
 

Users who are viewing this thread

Back
Top Bottom