• Access Forms – How to set field default value = to another field on form

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Access Forms – How to set field default value = to another field on form

    • This topic has 3 replies, 3 voices, and was last updated 14 years ago.
    Author
    Topic
    #476335

    I have a form that I use to update a table. The form is used to record details of activities that generally start and finish on the same day, but not always. Accordingly I have two fields on my form: Start_Date and Finish_Date, and I would like Finish_Date to be automatically populated and only changed if the activity runs beyond the day it started.

    I would like to be able to set the Default Value for Finish_Date equal to the value entered in the Start_Date field and have tried setting the default value to =[Start_Date], but nothing happens.

    I’m guessing the solution is simple, but I just can’t find it. Any help will be much appreciated.

    Viewing 0 reply threads
    Author
    Replies
    • #1277665

      Use the AfterUpdate event of the Start_Date field to set the value of Finish_Date.

      Code:
      Private Sub Start_Date_AfterUpdate()
         If Not ISNULL(Me.Start_Date)  Then
           Me.Finish_Date = Me.Start_Date
         End if
      End

      You may want to do additional testing to see if Finish_Date already has a value and then act accordingly.:cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    Viewing 0 reply threads
    Reply To: Access Forms – How to set field default value = to another field on form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: