By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

Update date automatically

P: 2
In my Access form, users update 11 check boxs when their work is completed, when this 11 boxed checked then the 12th check box will check automatically using after update & updatelast event.
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?
Breaking my head

Expand|Select|Wrap|Line Numbers
  1. Private Sub Updatelast()
  2. 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
  3. 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 event to use.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Check110_Click()
  2. If (Me!Check110 = "Yes" Or "True" Or "-1") Then
  3. Me!Text125 = Date
  4. Else
  5. Me!Text125 = Null
  6. End If
  7. End Sub
Any help, highly appreciated!!!
Mar 24 '14 #1
Share this Question
Share on Google+
3 Replies


zmbd
Expert Mod 5K+
P: 5,397
I'll give you a hint here

Try this on a new form
Add just the check box named check2
and just the text box named text0

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Check2_Click()
  5.     If Me.Check2 Then
  6.         Me.Text0.Value = Date
  7.     Else
  8.         Me.Text0.Value = Null
  9.     End If
  10. End Sub
See the two differences between your code and mine?

Check boxes are typically true/false by default and can be set to triple state true/false/null in the properties.

perhaps the value isn't absolutely needed for the textbox; however, I tend to use it.
Mar 24 '14 #2

P: 2
Hi,

Thank you for your idea.

But i can't use the onclick event, because check110 not updated by user, based on the other checkboxes it will update automatically.
This is were i got struck.
Mar 25 '14 #3

zmbd
Expert Mod 5K+
P: 5,397
You'll have to see if the onchange event will work as none of the others will trigger when the control is set via VBA until the record changes or the user interacts with the control.
Not sure why you are doing this with this control... seems awfully bashed-togeither.
Mar 25 '14 #4

Post your reply

Sign in to post your reply or Sign up for a free account.