Code in Subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mgstlucia
    New Member
    • Mar 2008
    • 30

    Code in Subform

    I have a form (Order Form) with a subform within it (Products subform1). I would like the ProductName and UnitPrice field to automatically fill in when you choose a SKU number. This works for the name and address in the main form but not in the subform.

    This is what I have in the Event Procedure box on the SKU combo box:
    [code=vb]
    Private Sub SKU_AfterUpdate ()

    Me![ProductName] = Me![SKU].Column(1)
    Me![UnitPrice] = Me![SKU].Column(2)
    End Sub
    [/code]
    What I'm I doing wrong. Do I need to reference the subform name somewhere?

    Thanks
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Hi there,

    There's a nice article in the Howtos section on referencing items in a subform. Here's the link: Referring to Items on a Sub-Form

    If you have further questions afterwards please feel free to ask them.
    Hope this helps you out,

    Jking

    Comment

    • mgstlucia
      New Member
      • Mar 2008
      • 30

      #3
      I looked at the How To article on this, but I'm still confused. I have put the subform name in before the control name but it is still not working. Can someone help?

      Thanks

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Originally posted by mgstlucia
        I looked at the How To article on this, but I'm still confused. I have put the subform name in before the control name but it is still not working. Can someone help?

        Thanks
        It would have been helpful to show what you did put, because it should look like this:
        [code=vb]Me![subformname].Form![ProductName] = Me![SKU].Column(1)
        Me![subformname].Form![UnitPrice] = Me![SKU].Column(2)[/code]
        -Stewart

        Comment

        • mgstlucia
          New Member
          • Mar 2008
          • 30

          #5
          Thanks. I figured it out.

          Comment

          Working...