Results 1 to 5 of 5
  1. #1
    Aimee is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    19

    Question Adding a datestamp when a checkbox is ticked

    I have a form with a check box which states whether the patient is 'new' or not. If I have ticked that the patient is new, I need to automatically record the date that they were added.

    This is with the ultimate aim of creating a query which details this information.

    Please could somebody explain (in very simple terms) how I would go about doing this?

  2. #2
    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
    Replacing chkNewOrNot with the actual name of your Checkbox and DateStamp with the actual name of your Textbox that will hold the DateStamp date.

    Code:
    Private Sub chkNewOrNot_AfterUpdate()
     If Me.chkNewOrNot = -1 Then
      Me.DateStamp = Date
     Else
      Me.DateStamp = Null
     End If
    End Sub


    The 'Else' Clause is needed in case the user ticks the Checkbox and realizes that this was a mistake.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    To add to Linq's answer, the system can tell if this is a *new* record and add the timestamp automatically if you want.

  4. #4
    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
    I think the Records will always be 'new,' in Access' meaning of new. The 'new' here, I believe, means new to the medical practice, i.e. they've been there before and already have one or more Records.

    But I could be wrong! I have been before...or so my exes tell me!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Aimee is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    19
    Thanks Linq
    Yes you are right about 'new' as in 'new to the practice'.

    I really appeciate your help but I am a complete novice with Access. What is the 'code' and where do I type this into?

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

Similar Threads

  1. If Checkbox is ticked, Data Must be entered
    By DTK0902 in forum Access
    Replies: 8
    Last Post: 12-01-2012, 04:32 PM
  2. Help about adding up sums using a checkbox.
    By MelonFuel in forum Forms
    Replies: 1
    Last Post: 06-29-2012, 06:16 AM
  3. Datestamp for Checkbox-Query
    By Ran in forum Programming
    Replies: 24
    Last Post: 01-18-2012, 11:22 AM
  4. Replies: 3
    Last Post: 12-19-2011, 11:18 AM
  5. Open report if checkbox is ticked
    By Patience in forum Reports
    Replies: 3
    Last Post: 06-23-2010, 08:34 AM

Tags for this Thread

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