Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Unanswered: Updating parent form from child ...

    Hi all...

    I'm trying to cudgel my brain to think of a "nifty" way to update some "totals" labels on my main form after performing some changes/record additions on my child form ... This child has 21 columns corresonding to each day of the week for 3 weeks. When I add hours for any given day within that 3 week period I want that the labels on the parent form get updated with the new total for the column ... Any ideas?

    Thanks!

    P.S. - Performing the necessary query/queries is not the issue here ... It's the mechanism for doing so that I'm looking for ...

    I've considered public functions, public events (but on what?) ...
    Back to Access ... ADO is not the way to go for speed ...

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What method are you using to transport the sum? DSUM, form references, public vars?

    I would trigger a DSUM function in the After Update event of the subform personally.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Teddy
    What method are you using to transport the sum? DSUM, form references, public vars?

    I would trigger a DSUM function in the After Update event of the subform personally.
    Ted,

    Well that is the issue ... See, what I'm going to do is run a function that performs the query to update all the labels that display the daily totals (got that - works great). What I'm trying to do is figure a means to do it ... I have the subform text control's After_Update event (and for that matter the subform's After_Update event). I need to trigger something that will perform my query function on the parent form ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Jun 2004
    Posts
    96
    After Update event is already the trigger...
    you can reference to the parent form by me.parent..

    How is the query function being performed now when you are on the parent form? it returns a value, etc??

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Cyherus
    After Update event is already the trigger...
    you can reference to the parent form by me.parent..

    How is the query function being performed now when you are on the parent form? it returns a value, etc??
    Those are fine for the child ... Here's the problem: the querying is done within a function. Not within or under the control of an access control (textbox, combo, list, etc ...) and as such I COULD make the function public but if I do so and invoke it from the child form, the action will have the scope of the child NOT the parent to which the function was written for ... (been there). What I can do is a little trickery by invoking the after-update event for a textbox which will do my dirty work ...
    Back to Access ... ADO is not the way to go for speed ...

  6. #6
    Join Date
    Jun 2004
    Posts
    96
    why not pass the control as parameter to the function, and this function updates the control with the result..

    eg: public ReCal(txtbx as TextBox)

    calling:
    ReCal(me.parent.controls("textbox name"))

    would this work?

    worse case, hardcode in ur function which text box to be updated with the result..
    ReCal()
    forms!"parent form name".controls("textbox") = result
    end

    Just suggestions..
    Last edited by Cyherus; 06-23-04 at 00:03.

  7. #7
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Cyherus
    why not pass the control as parameter to the function, and this function updates the control with the result..

    eg: public ReCal(txtbx as TextBox)

    calling:
    ReCal(me.parent.controls("textbox name"))

    would this work?

    worse case, hardcode in ur function which text box to be updated with the result..
    ReCal()
    forms!"parent form name".controls("textbox") = result
    end

    Just suggestions..
    Just one teeny tiny problem: What gets updated by this function is 21 labels representing each day for 3 weeks (re: original post)... It's not a single control to be updated. It's 21 to be updated ... And no, I'm not thrilled with doing 21 DCounts in the child ...
    Back to Access ... ADO is not the way to go for speed ...

  8. #8
    Join Date
    Jun 2004
    Posts
    96
    I did a small simulation of what you wrote..
    not sure if this helps..
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Cyherus
    I did a small simulation of what you wrote..
    not sure if this helps..
    I looked at your sim and the subform does the calcs for the parent ... Nifty...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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