Results 1 to 8 of 8
  1. #1
    Chuggers75 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    10

    Dates in form

    Hello,
    I am trying to figure out how to populate a date in one text field within my form, that will then populate another field for 15 days out.



    I am still learning access so any help would be appreciated! Thank you!

    Traci

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Are these bound or unbound fields (are they linked to fields in a query or table)?
    What you would essentially to do is add VBA code to the AfterUpdate event of the date field you are entering into that will populate the other one with a date 15 days from the field that was just entered into, i.e.
    Code:
    Private Sub txtDate1_AfterUpdate()
        If IsDate(Me.txtDate1) Then
            Me.txtDate2 = Me.txtDate1 + 15
        End If
    End Sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Requires code (VBA or macro) to save the calculated value into table field. However, why save? Can just calculate in query or textbox when needed: [field1] + 15
    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
    Chuggers75 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    10
    They are linked to a table.

  5. #5
    Chuggers75 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    10
    I am not sure I understand. If the text field is part of table how or where would I insert the [Field1] + 15 ?

  6. #6
    Chuggers75 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    10
    I don't know where I would add that code. Sorry, I don't know access that well.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    You could use Calculated type field in table.

    Otherwise, use the expression in query or in a textbox ControlSource.

    Performing calculations with fields is basic functionality. Any introductory tutorial book would have covered this. Have you completed any tutorials?
    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.

  8. #8
    Chuggers75 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    10
    No I haven't

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

Similar Threads

  1. Replies: 8
    Last Post: 12-02-2013, 03:46 PM
  2. Replies: 1
    Last Post: 07-26-2012, 10:51 AM
  3. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 PM
  4. Replies: 10
    Last Post: 11-16-2011, 10:58 AM
  5. Mixed dates - show only complete dates?
    By weeblesue in forum Queries
    Replies: 3
    Last Post: 10-27-2010, 02:15 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