Results 1 to 9 of 9
  1. #1
    KDTom is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    7

    Question Checkbox sets current date in textbox - how to?


    I'm using Access 2007. I have a checkbox ("Mailed") on a form; on that same form I have a textbox ("MailedDate"). On click, I'd like the textbox to display the current date. Seems as though it should be easy, but I'm a novice. Any direction would be appreciated. Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Is the checkbox bound to field? Why have a checkbox and date fields? If there is a date in the field then you know item was mailed. Check field is redundant.

    Just enter date in the date field or have a button coded to enter date into the field.
    Me.datefield = Date()
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    KDTom is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    7
    Thanks, June7! I told you I was a novice! I wanted the button to supply the date without having to use a date picker or click in the textbox; just thought I'd click and go on but perhaps I'm not looking at things from the right perspective. I'd like to open the form on another day and see that an item was mailed on a certain day. Thanks for your help.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Two fields is redundant but a command button to populate box with current date is reasonable.

    Can also set the textbox DefaultValue property to Date() and will populate for new record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    KDTom is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    7
    I guess what I wanted was to click the button and have it enter the date. This won't necessarily be the date the record is created. I think I'm in over my head. Should I use the button instead of the checkbox? Also (and I'm embarrassed to ask), what is the significance of "me" in the code? Does it refer to the form, a control or ...?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    I would not use two fields that essentially relay the same info 'report was mailed' - however, date value is more informative.

    I would use a button event to offer user shortcut for entering current date.

    So the DefaultValue approach is not desirable.

    Me is VBA alias for the form/report that code is behind.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    KDTom is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    7
    Thanks, June 7. I don't want to seem grouchy or discouraged (truthfully I AM both) but I've been at this problem all day long now and I'm not getting anywhere with it. I certainly thank you for your help, though. I don't think I've conceived the form the way someone else might have and that's probably the problem. I just wanted a shortcut to put in the current date without having to type it in; I'll go rethink my form. Thanks again.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    That's why I recommend a command button sitting next to the date textbox. But on second thought that might not work if the form is in Continuous or Datasheet view. I was picturing Single view.

    Another alternative could be the Enter event of the date textbox. When user enters the textbox the date could be automatically filled in or user could be prompted with a question first if the field is still null: Do you want current date entered?

    Let me know what appeals to you. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    KDTom is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    7
    Thanks, June7.

    I'm abandoning the project. It's taking up too much time at work for a small return. It's nice, though, to have somewhere to turn. I'm sure I'll have more questions in the future. Thanks again for taking your time for me!

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

Similar Threads

  1. If checkbox is checked, add X to a current value
    By INeedAboutTreeFiddy in forum Programming
    Replies: 4
    Last Post: 05-30-2012, 08:17 AM
  2. Insert Multiple Checkbox Values to one Textbox
    By dshillington in forum Programming
    Replies: 1
    Last Post: 12-28-2011, 10:10 AM
  3. Replies: 1
    Last Post: 12-07-2011, 01:02 PM
  4. Set textbox field to depend on current date
    By lilanngel in forum Queries
    Replies: 6
    Last Post: 03-10-2011, 08:16 AM
  5. Combining textbox and checkbox data
    By jgarner in forum Access
    Replies: 0
    Last Post: 12-11-2008, 11:10 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