Use input to one field in a form to populate another field on the form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sourcemb
    New Member
    • Apr 2010
    • 1

    #1

    Use input to one field in a form to populate another field on the form

    I have an Access database that has been developed using only the native Access tools and a few macros. I have found the need to use one of the controls on a form (contains a date field from one of the tables populated by user entry) to populate another control (another date field in the same table) based on what is contained in another populated field on the form. It appears the only way to do it is via VBA and I can't figure out how to get the data from and to the form. The basic code is being called in an event when the user tabs off of an input field (lost focus)

    Private Sub DiscipleEnd_Chk ()
    If Me.DiscipleStar t Is Not Null AND Me. Controls!Discip leEnd Is Null Then
    Me.Controls!Dis cipleEnd = Me.Controls!Exi tDate
    End If
    End Sub

    Obviously don't have any idea what I am doing here and while it seems simple, basic programming logic is not sinking in no matter how many sites I look at for examples. Any help would be appreciated
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    the ME statement makes reference to the active form itself. so, if you want something from your current form to lets say Form1, :

    Form1.Controls! DiscipleEnd = Me.Controls!Exi tDate

    HTH

    Comment

    Working...