By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Help with code??

P: 8
Hi. I am trying to make a cashbook in Access for my fathers business.. I am new to Access and Bytes. I made a table with the following fields: ID (primary key), Supplier, Date, Invoice Number, Details, Zero Rated (this is a check box with a yes/no data type), Amount, VAT. I highlighted the VAT column in design view and went to default value and put this in

Expand|Select|Wrap|Line Numbers
  1. IF([Zero Rated]=0,[Amount]*0.14,0)
BTW the name of the table is Purchases. I am getting errors with this formula though. Please help me where I am going wrong and also tell me what I am doing wrong.. I am keen to learn Access. :)

Jan 19 '10 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,072
If it's in the form field try:
Expand|Select|Wrap|Line Numbers
  1. =IIF([Zero Rated]=0,[Amount]*0.14,0)
Personally I would use a separate TaxRate table and get the % from there for the calculation.

Jan 19 '10 #2

P: 8
Hey man.. I tried that and it works but then in the form if i put in 10 in the amount the vat will show 1.4 but then when i press enter to record it it doesnt appear in the VAT column in the table..

any ideas?
Jan 20 '10 #3

Expert 2.5K+
P: 3,072
A field holding an "=" is by definition "Unbound", and thus not stored.
Due to the normalization rules we normally don't store results of an algoritm, but apply it when needed on the "basic" data. Thus when the basics change the result will still be "in line".
The same IIF() can be used in a query, thus actively creating the column when needed.

Getting the idea ?

Jan 20 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.