Automatically Populating a Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Glavey
    New Member
    • Mar 2007
    • 1

    #1

    Automatically Populating a Field

    Hello anyone any idea how to do this.
    The problem I am having has to do with Continuous Forms.

    In the header of the form I have 4 Combo boxes. For now lets just work on one combo box. The combo box name is 'PYID'. The table name is 'Invoice' and the field name is 'PYID' and that field is column 3. Thats if in access columns start at 0.

    OK What I want to do is this, when a user selects a value from PYID combo box in header it will be the same value for all entries in the Continuous Form. So when the those entries are save to table 'Invoice' all the PYID field values are the same for that session of the form. Not all the PYID entries in the table only the entries for that form session.

    Any questions ask.
    Thanks for the help.

    Paul
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Hi Paul,

    Firstly name the combobox something else to avoid confusion. For now I'll go with cboPYID

    In the AfterUpdate of the combobox set the subforms default value for PYID to the third column of the combobox.
    Code:
    Private Sub cboPYID_AfterUpdate()
    
       Me!SubformObjectName!PYID.DefaultValue = Me!PYID
    
    End Sub
    Mary

    Comment

    Working...