Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Texas, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've seen a lot of posts on how to get subtotals from subform to main, I have the opposite problem.

    I have a main form that I'm using to allocate money to one or several people. There are usually at least 10 records in the main form that show what the award is for and how much total is given for each award. The main form/subform are linked by an id field. The subform is a datasheet that has a dropdown list of names (emp. #), amount given, and id field that links the 2 forms and starts off with no records.

    If $1000 is the amount, I'd like to reflect this on the first record in the subform. Once I choose a name and type in $250, I'd like the 2nd record to show $750. I choose another name and type $400, I'd like the 3rd record to show $350, etc.

    Can anyone give me a hint on how to get started with this?

    I've managed to get the id field in the subform populated with the id field from the main form by using the following code in the On Current event of the form. But the amount field will not populate. And I can't figure out how to do the deductions. Any help is appreciated.

    Forms![frmAwards]![sfrmAwardsSubTotal].Form![sAwardID] = Me.txtAwardID
    Forms![frmAwards]![sfrmAwardsSubTotal].Form![Amount] = Me.Amount
    Thanks,
    El

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Could you post a stripped down copy of your database? See post 401925 for instructions.

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Location
    Texas, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's really stripped to the bare bones.

    As you probably can tell, I used a form template from Microsoft that shows how to use a subtotal from a subform. I thought I could just reverse what they did.

    Thanks,
    El
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You don't need code in the main form, only in the subform:

    Private Sub Form_BeforeInsert(Cancel As Integer)
    Me.Amount = Me.Parent!Amount - Nz(Me.txtOrderSubtotal, 0)
    End Sub

    (I changed the names of the bound controls to reflect their control source)

    See the attached version: [attachment=82658:Award2K.zip]
    Attached Files Attached Files

  5. #5
    New Lounger
    Join Date
    Mar 2002
    Location
    Texas, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans, Thank you so much!

    El

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •