Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I have an invoice form with tw (2K/SR2)

    I have an invoice form with two subforms. One subform has a list of bookings + amounts, plus a grand total (this becomes the invoicing amount); the second subform has a list of instalment payments, plus a grand total of these. On the main form I have two text boxes (PmtTot & InvTot) which display both grand totals and I have another text box (PmtOutstandingAlert) which is to display a text msg only if there is money outstanding.

    I am trying variations of the following code but it isn't working. What am I doing wrong?

    If Me.PmtTot <> Me.InvTot Then
    Me.PmtOutstandingAlert.Visible = True
    ElseIf Me.PmtTot = Me.InvTot Then
    Me.PmtOutstandingAlert.Visible = False
    End If

    Many thanks
    Nick

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: I have an invoice form with tw (2K/SR2)

    Where have you put this code? It should be fired whenever either the invoicing amount or the payment amount changes:
    <UL><LI>In the OnCurrent event of the main form
    <LI>In the AfterUpdate event of each control on the first subform that influences the invoice amount
    <LI>In the AfterUpdate event of each control on the second subform that influences the payment amount[/list]In the AfterUpdate events on the subforms, you are referring to a control on the main form, so use

    Parent!PmtOutstandingAlert

    there.

    HTH, Hans

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I have an invoice form with tw (2K/SR2)

    At the moment, it is on the On Current event for the Main Form only. As I navigate through the records, the only thing that displays are the two text boxes (PmtTot & InvTot). The text box PmtOutstandingAlert, will not display at all on any record.

    I understand what you say about using the AfterUpdate event and I will probably end up using that, but at the moment, using the On Current event isn't working.

    Thanks
    Nick

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: I have an invoice form with tw (2K/SR2)

    Why don't you post your DB and give people a chance to fix/test/??? it?
    I don't have much on this weekend.
    Pat

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: I have an invoice form with tw (2K/SR2)

    This is trickier than I thought. When you move to another record, the Current event occurs. At that moment the subforms have been cleared, so both totals are Null. The subforms are updated after the Current event of the main form has finished. Not unreasonable if you think about it. As a consequence, the test on PmtTot and InvTot is never evaluated correctly.

    I tried using the Current event of the subforms, but that causes problems when opening the form.

    The only workaround I can think of at the moment is rather clumsy. Probably somebody else will have a better idea.

    Put the code in the Timer event of the main form and set the Timer Interval to 500 (milliseconds). That way, the visibility of the PmtOutstandingAlert text box is updated periodically. You can experiment with the timer interval. If it's long, the user might become confused because it takes a while before the text box appears/disappears; if it's too short, Access gets confused - this depends on the speed of your computer and the complexity of the form and subforms.

Posting Permissions

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