Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30

    working with formulas on textfields and storing them in tables!


    Hi guys I'm axel and I'm a real newbie in access I'm currently trying to design a database for my job but right now I'm stuck with a problem. I have two tables:

    "Incoming material" and "Invoices" and I'm currently working with them on a Form called "Main" which has the data from the "Incoming material" and it has the subform "sfrmInvoices" with the "Invoices table". I'm working with a formula on a textfield in the Main form which calculates the Total of the prices of the items shown int the subform. The Incoming material table has a field named Total where I'm supposed to store the value calculated on the textfield but I don't know how to do it? Even in the sub form i also placed a formula to calculate the subtotal (multiplaying the quantity by the unit price) but I can't store the subtotal either! What can I do? I you guys can help me! If I need to share some more details just ask I can even send the document I'm working with! thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    thanks for the quick response! bu the mail doesn't work

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The mail doesn't work? What mail?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    sorry I ment the link

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I just clicked on it and it worked fine. Is your company blocking it perhaps? Here's the first part:
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    pbaldy thanks for the image somehow it's not working for my but I googled the text on the image and I think I found the article (or I least i think I found it). On it it explains the use of a code on an afterupdate event so I tried this:

    End Sub

    Private Sub Tax_AfterUpdate()
    Call Actualiza
    End Sub

    Private Sub txtSubtotal_AfterUpdate()
    Call Actualiza
    End Sub

    Private Sub txtTotal_AfterUpdate()
    Private Sub Actualiza()
    Me.Total = Me.txtTotal
    End Sub
    End Sub

    Let me explain it!

    the txtSubtotal_AfterUpdate() refers to the update of a Textfield named txtSubtotal which has this formula:

    =[sfrmInvoices].[Formulario]![frmtxtSubtotal]

    On this formula I take the Subtotal calculated on the subform Invoices

    the Tax_AfterUpdate() refers tho the update of a Textfield named Tax which has this formula:

    =([txtSubtotal]*0.16)

    This one calculates a 16% tax over the result displayed on the txtSubtotal text field

    and the txtTotal_AfterUpdate() tries to store on the Total field of the current record the value contained in the txtTotal textfield which has this formula:

    =[txtSubtotal]+[Tax]

    Which is just the subtotal plus the tax.

    However this doesn't work any Idea on what am I doing wrong?

  8. #8
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    I'm attaching an image of what I'm currently doing:



    keep in mind the next things:

    IVA means Tax
    ant the Total tag in blue with the text field refers to the actual value of the Total field for this record. While the textfield on the right refers to the calculated field!

  9. #9
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This will error because you have one sub inside another:

    Private Sub txtTotal_AfterUpdate()
    Private Sub Actualiza()
    Me.Total = Me.txtTotal
    End Sub
    End Sub
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    nope already changed it... It doesnt work either

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Define "doesn't work". Error? Incorrect result? Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    By doesn't work it means that I just doesn't store the value. There's no error but nothing happens either. I'm not sure how can I post it if you want I can send it to your mail.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you compact and then zip, you should be able to attach it here. You have to be in the normal reply area, not the quick reply.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30

    My database

    Here's my database! keep in mind that it's in spanish lol but If you have any doubt please ask!

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Formatting formulas
    By katrinanyc926 in forum Queries
    Replies: 2
    Last Post: 08-16-2010, 07:52 AM
  2. Storing an Academic Semester
    By trb5016 in forum Database Design
    Replies: 1
    Last Post: 07-21-2010, 01:02 PM
  3. storing and printing on a pdf
    By jlm722 in forum Reports
    Replies: 4
    Last Post: 10-27-2009, 02:48 AM
  4. Replies: 1
    Last Post: 01-22-2008, 03:36 PM
  5. Replies: 0
    Last Post: 03-05-2007, 08:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums