Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have TransactionForm (main) on which resides DonationMain and DonationDetails. DonationDetails is synched to DonationMain and changes as you move from record to record in DonationMain.

    DonationMain is continuous forms.

    On the TransactionForm, there is a calculated textbox txtTotal which is updated via a custom function ttl(). This all works fine if you are entering new records into the database.

    Today I noticed, as you move from record to record on DonationMain, that txtTotal was not recalculating so it was always showing the total for the first record in DonationMain.

    I'm not sure of what syntax I need to use or where I need to use it on DonationMain to force the function ttl() to recalculate whenever a new record on DonationMain is selected. If I stick something into the OnCurrent event of DonationMain, it starts recalculating over and over (presumably because the combo box that displays names has to recalculate as the form is drawn, an unfortunate necessity due to legacy issues in the design). Of tried GotFocus and various other ideas but this one has me stumped now.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The On Current event procedure of DonationMain would be the place to recalculate the text box. If that causes problems, we'd have to know more about the code you're using. Without having any information it's impossible to provide recommendations.

  3. #3
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='786735' date='29-Jul-2009 14:35']The On Current event procedure of DonationMain would be the place to recalculate the text box. If that causes problems, we'd have to know more about the code you're using. Without having any information it's impossible to provide recommendations.[/quote]
    Maybe my syntax was wrong. I'm not at that location now, but I believe I was trying Me.Parent.Recalc I also tried specifying the actual textbox. I can't remember what I used for that.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Me.Parent.Recalc would be the first thing I'd try, but that will recalculate all calculated controls on the parent form.

    As an alternative, you might clear the control source of txtTotal, and set its value in the On Current event of DonationMain.

  5. #5
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='786737' date='29-Jul-2009 14:45']Me.Parent.Recalc would be the first thing I'd try, but that will recalculate all calculated controls on the parent form.

    As an alternative, you might clear the control source of txtTotal, and set its value in the On Current event of DonationMain.[/quote]

    I got it. I use the recordset.clone method to make sure there are some records in donationMain before I requery the function. It now only runs if there is data and recalculates properly when you switch records. There is a very complicated query for a lookup box in donation Main that is slow to run and it is now being forced to run when you switch records, but it is acceptable. It's actually still a lot quicker than just about anything running in Vista...

    Thanks for confirming yet again that I was looking in the right direction, just not quite right enough!

Posting Permissions

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