Results 1 to 11 of 11
  1. #1
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65

    How do I make button hit ESC key?


    I am trying to clear and reset the fields of a form with a RESET button. I would also like to, more importantly, make sure that hitting the reset button will update the timestamp that is auto filled. Currently, the timestamp just stamps the time of when the last entry was submitted, but it doesn't update as time goes on! So if I make an entry at 12:00 then wait 5 minutes, it still says 12:00 unless I close the form and re-open it. I need the timestamped field to update, or be able to be reset with this reset button.

    When I fill in some fields and then hit ESC a few times, it clears everything and updates the time. I think that is what I need the RESET button to do; Just a shortcut for hitting escape a few times perhaps. But I don't know how to do that.
    I have found some info on something called SendKeys, but I am not sure how to use that.

  2. #2
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    You know what.. I just used

    SendKeys "{ESC}", True

    And it flippin works. I always find the answer right after I post the question. But ONLY after, lol.

    So I got it.. Unless someone knows a way to make my timestamp update every minute so they dont have to reset at all?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What code is populating time stamp field?

    This form is bound to table?
    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.

  4. #4
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    In the timestamp field on the form itself, I have Default Value set to =Now()

  5. #5
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    And yes, the form submits entries to a table. I originally had the timestamp on the table itself set to =Now() but I changed it because I have another form that lets users manually enter the date and time and I didn't want it pre-filled in that one. So on this one, I have the form itself filling the input textbox with default value of =Now()

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I don't understand the issue. Record is time-stamped when it is created. Is that not suited to your requirements?

    And it should record Now() when the record is created, not the Now() of 5 minutes ago.

    What do you mean by 'submit'? Is this form bound - is its RecordSource set to table or query? Why would you need to 'clear' fields? Clearing would remove data from record. Move to new record row to 'clear'.
    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
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    In the form, the user enters the info and the timestamp is auto filled. There is a button I have labeled SUBMIT, but all it really does is GoTo New record. When it goes to a new record, it creates the new record timestamped at the time they hit the SUBMIT button. It technically creates the record at that time, in order forthe fields to blank out and the record they just entered to be "submitted" and over with. Now, say they SUBMIT a record at 12:00 and 10 minutes pass.. They get new info to enter a new record, but the timestamp still says 12:00 because that's when they hit submit the last time, and thus when the record was created. But say they now enter the info and hit SUBMIT again. The record they just now submitted still says 12:00, not 12:10 which is the time the new record is 'submitted' and not 'created' .. I hope that helps

  8. #8
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    And I have a "reset" button that clears all the fields by using SendKeys to ESC .. I am trying to tie in some sort of =Now() refresh into the reset button, so they can get in the habit of resetting before they enter data. Or maybe if there's a way to add a timer that updates the Now() every 60 seconds, but my core dillema is trying to find out how to update the default value to begin with, whether on a button press or timer of some sort.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Now I understand and stand corrected. Did some testing. I would remove Now() from the DefaultValue property and use some event to set value in the time stamp, such as the AfterUpdate of some textbox that user must enter data into or in the Submit click event. Something like:

    If Me.NewRecord Then Me!fieldname = Now()
    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.

  10. #10
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    Worked perfectly, thank you!

  11. #11
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    I don't know what I would do without the people on this forum. Life savers, all of you!

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

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2017, 03:03 PM
  2. Replies: 4
    Last Post: 02-06-2015, 03:58 AM
  3. Replies: 4
    Last Post: 02-12-2014, 12:49 PM
  4. How to make table from button on form
    By JackieEVSC in forum Forms
    Replies: 3
    Last Post: 11-04-2011, 06:44 PM
  5. How can I make a label a button?
    By BrainKing in forum Forms
    Replies: 6
    Last Post: 10-31-2010, 01:52 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