Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need help this is driving me nuts..

    I have a subform on a form that a user can input Receipt #'s.. This subform also counts the number of Receipt #'s in a field called Quantity using =Count[Receipt#].. This gives a total of the receipt numbers in the subform.. I have a another field on the main form called Qnty.. I want the value of this to be the total of the subform Quantity field.. I use the code below on the OnExit event of the Qnty field.. This works once the user exits that field.. My problem is that I would rather have the user not enter that field.. I tried using this on the Afterupdate of the subform Quantity field and the OnExit of the subform but it doesn't work.. Any thoughts? Thanks..


    Private Sub Qnty_Exit(Cancel As Integer)
    Forms![IDC RECEIPT FORM]![Qnty].Value = Me![ReceiptSubform]![Quantity]
    End Sub

    [img]/w3timages/icons/yikes.gif[/img][img]/w3timages/icons/yikes.gif[/img]

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need help this is driving me nuts..

    Just a thought, but can you not simply create a text box on the main form bound to the field on the subform; something like =[frmMySubForm].[Form]![Quantity]

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: I need help this is driving me nuts..

    Try using the AfterUpdate event of the subform itself. This happens each time a record is updated. Write the value from the subform to the main form using the parent object, like this:

    Parent![IDC RECEIPT FORM]![Qnty].Value = Me![Quantity]

    Since the subform has the focus and is where the code would go, the Me object refers to the subform and the Parent object is the main form.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need help this is driving me nuts..

    [img]/w3timages/icons/kiss.gif[/img][img]/w3timages/icons/kiss.gif[/img][img]/w3timages/icons/smile.gif[/img] Thanks everybody I got it fixed.. I was telling it the parent form as you mentioned.. Thanks again..[img]/w3timages/icons/laugh.gif[/img][img]/w3timages/icons/laugh.gif[/img]

Posting Permissions

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