Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access / ASP Problem

    Hi, I need help on a little function.

    I use an access database for a large list of products.

    I have 2x price tables, one for ex vat, and one for inc.

    The problem is that when I update it in the backoffice program, I have to enter the ex vat and also the inc vat. Very time consuming, and a big annoyance.

    The program i use to update is just 2 dynamic textboxes with an update button on a repeated region.

    Code:
    <input name="iprice" type="text" id="iprice" size="8" value="<%=formatnumber(rsprods.Fields.Item("SPRICE").Value,2,-1)%>">
    I'm pretty sure there is a way of setting this up in the database, but the expression builder is very confusing, and I've tried for ages to come up with something, if anyone knows access I need the [RPRICE] table to get the price from the [SPRICE] table and divide it by 1.175. (UK VAT Rate)

    And if I use that in the database, i can delete the RPRICE update feature, and when I update the SPrice table it should automatically work out the vat, and display it dynamically on pages.

    I figure this is what will happen, but theres always unexpected results.

    Appreciate any help at all.

    Thanks

    Jamie

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry, but i don't understand why you need two tables. Why not symply have 2 columns inside one table? or why not add the VAT on the fly when you compute a price?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry thats what i meant, I have got two rows, little mistake there.

    If anyone knows how to calculate from one row to the other?

    Thanks again

    Jamie

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    UPDATE your_tablename SET your_col_without_vat = (your_col_with_vat / 1.175)

    --> your course, you need to replace the table and columnnames with the ones in your table
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    on a sidenote, prob a better idea to use
    withVAT = (withoutvat*1.175)

    since then you can put the price you want, but i would just generate the vat to be dispalyed on the fly, i think you can also just set it to autoamttically add it from inside the field properties in access so it is just linked (default value property)

  • #6
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help, I'm pretty new to databases, and still having a problem, don't mean to sound stupid but do I enter it as the "default value"?

    I have tried all rows to try and get it working and cant seem to get it, if I enter it into the Default Value one, then I get "The database engine does not recognize either the field 'SPRICE' in a validation expression, or the default value in the table 'Products'

    Anything I'm doing wrong?

    Thanks again

    Jamie


  •  

    Posting Permissions

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