i am having trouble with default value

nawara

Registered User.
Local time
Yesterday, 19:52
Joined
Jul 23, 2008
Messages
29
hey
i have created a form in access..... in my form i have feilds named:
sub total
vat
total inclufing vat
in the form properties.. i clicked the All tab > the control saource and i set my formula to
=[sub total]*0.175 (0.175 being the VAT in england)
now some of my suppliers dont charge us any Vat so i was wondering if there was another way we could do this
someone told me to make a default value ..so that we have an option to change the values
though i am trying to write this formula in the defult value options, however it doesnt seem to be working
please can some one assist me.. i really need help
Regards Noor
 
Simple Software Solutions

The simplest way to do this with out going into the ins and ot of VAT calculations is to do the following

Me.VatContent = Iff(VatChargeable=True,Value*0.175,0)

in other words the iif statement is saying if the customer charges vat then do the calculation otherwise make the vat content 0.

CodeMaster::cool:
 
thank you for your quick reply
however i am writing the formula which u provided for me ... and now its not working out my vat!
help!!!!!!!!!!!!!!LooL
REGARDS Noor
 
Simple Software Solutions

You have three fields

Net amount
Vat Content
Gross amount

Net = 100
Vat = 17.5
Gross = 117.5

When the sub total field is populated then the default value for the vat should read

=Iff(Chargeable=True,[Vat Content] = [Sub total]*0.175,0)

Chargeable is a name of a field or a variable that idicates as to whether the customer charges VAT.

David
 
Simple Software Solutions

Send me a copy of your database
 
i am really grateful for this.. sorry if i am annoying you lol
the form which i am having dificulties with is under the name of supplier july 2008
thank you very much
ragards Noor
 

Attachments

Simple Software Solutions

I think you need to go back to the start and rethink how you want to build this app.

If this is going to be a full time app you need to read up about normalisation and naming conventions for table and fields, reserved words, etc.

One issue I did notice is that in your form you had a field named [VAT (T1)]

the default value was =Iff([Vat0.175]=True,[Value]*0.175,0) for a start you don't have a field called [Vat0.175] so the answer will never be called. You also do not have a field called [Value]

You do not have a field that indicates as to whether you should be calculating the VAT. And in any case as the suppliers data contains a VAT element for the record there is no need to perform a calculation.

Good Luck.
 
oh right i see
basically i strutured it as
sub total t1
sub totel T0
etc
i did this because i cudnt find a way to make the the vat as 0 or 17.5
but in an ideal world i wud only like to have one feild called sub total , vat, and total inc vat

ok instead of [value] wat wud be the equivelent based on my form?
lol sorry if iv confused u
i tent to confuse myself too
Regards Noor.
 
you need 3 fields
cost/value
VAT
Totalcost
in the after update of cost/value - or whatever you call it - have
VAT=Cost/vale or whatever0*17.5/100
in the after update field of VAT have
TotalCost= Cost/Value+VAT


this will mean that after you enter a value in your cost/value field the vat will autmoatically be created and also the totalcost
now you can delete the VAT by putting a zero in and it will recal the Totalcost
 
hey Gary thank you for your reply
currently i am doing that in control source
=[sub total (t1)]*0.175
however wen i write this formula in default value it dusnt calculate it automatically
the reason i need to write it in dafault value. is soo that i can correct the answer as some suppliers charge us vat and some dont
Regards Noor
 
- rethink your approach

you have a vaule field the formula needs to be on the after update filed on this
taking Davids field here


Net = 100
Vat = 17.5
Gross = 117.5

Net is your price/ value etc now after this has been entered (or calculated)
you need the VAT to do its thing and then after the update of the VAT then the Gross to give the total
(now this isn't the smartest way - but it is a logical way)

look at the attached zip file and in the customer form

slect something from th e combodrop down box -
ok prices is in the field now change either the price or the commission and it works out the retained - all you are doing is a variation on this
 

Attachments

you can also be smarter on your approach (I have not look at your DB)
but your customer account could hold wether they are vat registed with a simple tick box
then you could have select customer option and on the section make it look at the vat registered and then if true make the vat field work /and visible

but until you have the basics in place - hang fire on this sort of approach
 
oh right i seee
but how did u calculate the commision ?
correct me if i am wrong..
it looks like uv used your head to calculate it .. as there is no formula or rule in the forms properties?
wereas i would need access to calculate the vat for me automatically
 
the commission is a default amount held on a (seperate) table - this could easliy of been a default value on a table
 
the second option seems interesting .. how would i go about doing that ?
 
I have written what you want - but my system has gone tits up .. will post up a sample d/b on what VAT system
..

I presume you have an account (client table )on this you need 1 extra field called
VATRegistered - this needs to be a yes/no (default value to whatever you have the most of - Yes)
on your account form add this field to your form

now I doin't know how you set your select accoutn but I do my from a qry so now add this to your qry

have this field on your underlying main table (This is How i would do this)
when you select your account this should populate this field (as per my example in "Flash" ciustomer table /form
now you have a trigger to mess about with you will need a bit of coding along the lines of

After update on cost price etc (Zcost in the sample that i will whizz up in a min or so)
if vatregisted = 0 then
Vat = cost*0.175
totalcost = Zcost +VAT

end if
if vatregisted =-1 then
Vat = 0.00
totalcost = Zcost +VAT


I might of got my 0 and -1 round the wrong way and sometimes you need to change to true/false on the if element - my system has gone wrong so cannot double check this
 
managed to get this up

look at the code behind 1 - Zcost and 2-ZVAT on the after update code

this is the simple version which does not involve an account - it just does excatly what it says on the tin

note the use of Zcost - i use a prefix on fieldnames - this will ensure that you do not use a reserved word within access
and also no spaces in the names
 

Attachments

hey thanks for ur help
am not really firmiliar with codes were would i find codes.. ?
regards Noor
 
omg gary thank you sooo much iv finally dun it
am soo sorry to have been a pain
thank you soo much for your help.. it was more than appreicated
:D:D:D:D:D:D thank you!!!!!!
Noor
 

Users who are viewing this thread

Back
Top Bottom