Results 1 to 6 of 6
  1. #1
    bjr001 is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Posts
    8

    Checkbox to create date

    Hello,

    I've been having difficulty trying to have a checkbox enter a date in a field when ticked and remove the date when unchecked.



    Thanks for your help.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What do you have so far, and where do you have it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bjr001 is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Posts
    8
    = if «Expr» [boxout] =true then
    «Expr» [BoxOutDate]=Now()

    I've checked out some examples online, however I receive the same errors:

    "The expression you entered contains invalid syntax
    You may have entered an operand without an operator"

    Thanks.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try this VBA code in the after update event of the checkbox:

    Code:
    If Me.[boxout] = True Then
      Me.[BoxOutDate]=Now()
    Else
      Me.[BoxOutDate]=Null
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    bjr001 is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Posts
    8
    Hello pbadly,

    Thanks for the code and the lesson. It works as I asked.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help. I'll mark the thread solved.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 11:15 PM
  2. Checkbox
    By Patience in forum Access
    Replies: 5
    Last Post: 06-22-2010, 05:37 AM
  3. Using a checkbox help
    By gbjc105 in forum Forms
    Replies: 1
    Last Post: 01-28-2010, 08:27 PM
  4. checkbox
    By Suresh in forum Forms
    Replies: 0
    Last Post: 12-19-2007, 01:30 AM
  5. Create a date 'from' - 'to' on Report
    By Jule in forum Reports
    Replies: 7
    Last Post: 12-07-2006, 02:34 AM

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