Results 1 to 7 of 7
  1. #1
    efk0107 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    5

    checkbox to insert date


    Hi, I need to have a checkbox insert Now() into a field, when the checkbox is checked. This is to denote when a record has been updated to facilitate synching with remote data. Typically the checkbox will be False, but when the record is updated, we need to insert the current time and date. If the record is updated again in the future, we will then need to update the date/time stamp. Any help would be appreciated. I am weak in VB so specific answers would be most beneficial. Thanks, frank

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Why not just use the BeforeUpdate event of the Form to TimeStamp the record?

  3. #3
    efk0107 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    5
    We are constantly opening this form, but need to timestamp the record only if changes are made. Changes may be made on the remote end so we need to distinguish the most current record when syncing.
    .

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You *ONLY* get a Form BeforeUpdate event when the Form is Dirty, meaning something on the Form is different than what is in the table.

  5. #5
    jmbreland is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Posts
    3
    What if (this is my situation) you want the date/time field to update ONLY if the checkbox is changed from FALSE to TRUE? (In other words, I don't want other changes to the record to result in a date/time update).

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Please provide more details and perhaps an example. Your requirement is NOT clear (to me).
    Why do you need a checkbox? Seems Allan's approach is feasible.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by jmbreland View Post

    What if (this is my situation) you want the date/time field to update ONLY if the checkbox is changed from FALSE to TRUE? (In other words, I don't want other changes to the record to result in a date/time update).
    Code:
    Private Sub CheckboxName_AfterUpdate()
     
     If Me.CheckboxName = -1 Then
       Me.TimestampControl = Now
     Else 'This is needed if user mistakenly ticks the checkbox then unticks it
        Me.TimestampControl = Null
     End If 
    
    End Sub


    Linq ;0)>

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-08-2013, 11:34 AM
  2. Replies: 8
    Last Post: 11-19-2012, 09:22 AM
  3. Insert date function
    By geraldk in forum Forms
    Replies: 2
    Last Post: 01-01-2012, 06:37 PM
  4. Insert Multiple Checkbox Values to one Textbox
    By dshillington in forum Programming
    Replies: 1
    Last Post: 12-28-2011, 10:10 AM
  5. Checkbox to create date
    By bjr001 in forum Access
    Replies: 5
    Last Post: 11-10-2010, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums