Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2003
    Posts
    150

    Unanswered: Form/Subform driving me nuts!

    Hi,

    I have a form ( invoices ) with a subform ( invoice details ) in it. In the main form, i have two option groups to determine the taxation level. There are 5 fields that i want to update when a change is made in the subform: Subtotal, Tax1, Tax2, Tax3 and Total. For some reason, i can only update Subtotal, the rest doesnt change. The only way to update the remaining 4 fields is to select another taxation and come back to the initial one i need.

    There is a default taxation, and i've set the option group default to it, but i doesnt update the related fields....

    any help?
    Cheers!

    Mr.Crud

    There are 10 kinds of people, ones that understand digital, others that dont

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    How are you updating the fields? Are you doing so via vba or are they calculated fields? If they are calculated, then does a me.recalc or a me.refresh in the option group after update event fix it?

  3. #3
    Join Date
    Nov 2003
    Posts
    150
    Everything is calculated by VBA. I put the calculation procedures in the after-update event of some fields and in the before-update fields that need the calculation, but for some reason, it will only update some of the fields......The fields that dont get updated are the ones that depend on the values of my option groups.

    For now, i've given up and set a button next to each subform that will update the rest of my controls. I'm still looking for a solution, but i dont want to spend too much time on this, as it is not absolutely crucial to the system...

    thanks for the help!
    Cheers!

    Mr.Crud

    There are 10 kinds of people, ones that understand digital, others that dont

  4. #4
    Join Date
    Nov 2003
    Posts
    150
    crap.... even my command button wont do it properly..... i have to click twice on it for it to update the proper fields. It's as if it's not getting a value for the Subtotal field quick enough, and then bases the calculations on the default value 0. If i click again, it'll work.

    Any way to speed up the requery? If before my code to update all the fields, i add this command: Subtotal.Requery, it doesnt seem to do anything.....


    help!!?!!!
    Cheers!

    Mr.Crud

    There are 10 kinds of people, ones that understand digital, others that dont

  5. #5
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    How are you calculating the taxes and totals? Are you using a recordset then updating and refreshing the form at the end? Post your code if you like.

  6. #6
    Join Date
    Nov 2003
    Posts
    150
    Here's my code so far:

    Frame 60 and 67 are my 2 option groups.

    ------------------------------------------------------------------------------------

    Private Sub Command78_Click()


    If Me!Frame60 = "1" Then
    OptionQc.Enabled = True
    OptionMaritime.Enabled = True
    OptionCan.Enabled = True

    If Me!Frame67 = "1" Then
    TextTPS.Visible = True
    TextTVQ.Visible = True
    TextTVH.Visible = False
    TextTPS.Value = Me!Items.Form!curSubtotal * 0.07
    TextTVQ.Value = (Me!Items.Form!curSubtotal * 1.07) * 0.075
    TextTVH.Value = 0
    Text42.Value = Me!Items.Form!curSubtotal + TextTPS + TextTVQ + TextTVH + curShippingCharge

    ElseIf Me!Frame67 = "2" Then
    TextTPS.Visible = True
    TextTVQ.Visible = False
    TextTVH.Visible = False
    TextTPS.Value = Me!Items.Form!curSubtotal * 0.07
    TextTVQ.Value = 0
    TextTVH.Value = 0
    Text42.Value = Me!Items.Form!curSubtotal + TextTPS + TextTVQ + TextTVH + curShippingCharge

    ElseIf Me!Frame67 = "3" Then
    TextTPS.Visible = False
    TextTVQ.Visible = False
    TextTVH.Visible = True
    TextTPS.Value = 0
    TextTVQ.Value = 0
    TextTVH.Value = Me!Items.Form!curSubtotal * 0.15
    Text42.Value = Me!Items.Form!curSubtotal + TextTPS + TextTVQ + TextTVH + curShippingCharge

    End If

    ElseIf Me!Frame60 = "2" Then
    OptionQc.Enabled = False
    OptionMaritime.Enabled = False
    OptionCan.Enabled = False
    Me!Frame67 = "4"
    TextTPS.Visible = False
    TextTVQ.Visible = False
    TextTVH.Visible = False
    TextTPS.Value = 0
    TextTVQ.Value = 0
    TextTVH.Value = 0
    Text42.Value = Me!Items.Form!curSubtotal + TextTPS + TextTVQ + TextTVH + curShippingCharge

    End If

    End Sub

    ----------------------------------------------------------------------------------

    thanks a lot!
    Cheers!

    Mr.Crud

    There are 10 kinds of people, ones that understand digital, others that dont

  7. #7
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    How about putting:

    if me.dirty then docmd.runcommand accmdsaverecord

    or just

    docmd.runcommand accmdsaverecord

    as your first line of your command button.

  8. #8
    Join Date
    Nov 2003
    Posts
    150
    hmmmm can you explain a little deeper the code you suggest? I usually like to understand code before using it...

    i put :

    docmd.runcommand accmdsaverecord

    as my first line, but it didnt make a difference...

    thanks a lot!
    Last edited by MrCrud; 02-27-04 at 17:58.
    Cheers!

    Mr.Crud

    There are 10 kinds of people, ones that understand digital, others that dont

Posting Permissions

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