Results 1 to 4 of 4
  1. #1
    MHernan1 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    18

    Entering Current date in a field via a form button?

    Hi all,



    I am trying to figure out to have the current date populate in table field by using a button on a form and not having much luck.

    I have a table with 2 date fields, a 'created' field and a 'received' field. I already have the date set to auto populate for the 'created' field but I don't want the 'received' field to populate until the employee has gone into the database to receive the work.

    I know I could have the employee just enter the date, but i want to avoid any typos or people simply forgetting to do it.

    Ideally I would love the button to enter the current date into the 'received' field and save the entry, but I fine it needs to be 2 seperate buttons.

    Any help would be greatly appreciated!

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Assuming your command button is named "cmdUpdateRecDate" and your Received Date text box is name "txtRecDate", you would just use the following code in the "Click" event of your command button:
    Code:
    Private Sub cmdUpdateRecDate_Click()
        Me.txtRecDate = Date
    End Sub
    If your txtRecDate field is bound to the Received Date field in the underlying table, there shouldn't be any reason to save it. Saving happens automatically.

  3. #3
    sklim is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    2
    For the button, create an event procedure via the property sheet and when the code window comes up, enter me.whatever_the_field_name_is.value = date()

  4. #4
    MHernan1 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2012
    Posts
    18
    Perfect, thanks very much for the help!

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

Similar Threads

  1. Replies: 1
    Last Post: 04-25-2012, 12:36 PM
  2. Replies: 2
    Last Post: 04-24-2012, 01:26 PM
  3. Replies: 2
    Last Post: 09-25-2011, 08:52 AM
  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. Current Date button on Report
    By Steven.Allman in forum Programming
    Replies: 8
    Last Post: 10-31-2010, 03:28 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