Hii guys this is my first post here , first of all Thank you for reading this
message and even more is you can help me with this issue .
I am trying to do a querue from various tables and need to include a
computed field which will work like the if command in Excel ie
= if ( field XX > 0, field XX * Field YY,Field XX * Field ZZ)
can some tell me if this is possible and if yes how i should type it ?
Thanking you all
Anton Cini

Signature
Access For Fun
fredg - 28 Jun 2007 00:25 GMT
> Hii guys this is my first post here , first of all Thank you for reading this
> message and even more is you can help me with this issue .
[quoted text clipped - 8 lines]
>
> Anton Cini
Well you've done pretty well.
In Access you would use IIf()
In a query?
NewColumn:IIf (field XX > 0, field XX * Field YY,Field XX * Field ZZ)
Look up IIf in VBA help.
You do know, I hope, that in Access you do not save calculated data in
a table. Any time you need this calculated data re-calculate it.

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Wayne-I-M - 28 Jun 2007 10:18 GMT
Hi Anton
In your example
= if ( field XX > 0, field XX * Field YY,Field XX * Field ZZ)
Ensure that you have the table containing the fields in the query and create
a calculated column (right click and select build). You would need to write
something like this.
Result:IIf ( [TableName]![FieldXX] >0, [TableName]![FieldXX] *
[TableName]![FieldYY] , [TableName]![FieldXX] * [TableName]![FieldZZ] )
Of course change the TableName and field Names to what they really are.
_________________________________________
In an access query you can create calculated columns that will perform
calcuations if certain criteria are true and if they are not tru perform
different calculations.
Like this
Result:IIF([TableName1]![FieldName1]>0,[TableName2]![FieldName2]*[TableName3]![FieldName3],[TableName2]![FieldName2]*123)
The above calculation would ask
If the field called FieldName1 in a table called TableName1 is more than 0
then multiply the contents of the field called FieldName2 in TableName2 by
FieldName2 in TableName3. If the is NOT true then muliply FieldName2 in
TableName2 by 123 (one hundred and twenty three).
The basics are that with an IIF you ask is something true or is it not. If
it is you do "something" and if it's not then do "something" else. Hope this
make sense.
Hope this helps

Signature
Wayne
Manchester, England.
> Hii guys this is my first post here , first of all Thank you for reading this
> message and even more is you can help me with this issue .
[quoted text clipped - 8 lines]
>
> Anton Cini
Anton - 28 Jun 2007 15:46 GMT
Hii Fred/Wajne
Thank you for your help , i am using the formula i will pastit below so you
can check it please the problem is it is not working correctly for the first
record .
I will give it some trying myself as i dont want to be a pest , then i will
come back here.
Thank you all

Signature
Access For Fun
> Hi Anton
>
[quoted text clipped - 43 lines]
> >
> > Anton Cini
Anton - 28 Jun 2007 22:00 GMT
Wahhoooo.
did it it is working fine i have it done thank you guys ,, will be look ing
often here.
I small think where do i find the VBA help ?
thank you
Access for Fun

Signature
Access For Fun
> Hii Fred/Wajne
>
[quoted text clipped - 54 lines]
> > >
> > > Anton Cini
Wayne-I-M - 28 Jun 2007 23:16 GMT
Hi Anton
I am pleased it worked for you.
You can get help on VBA by pressing F1 in access and puttng the question in
the box. Or, if you have a specific problem you can post it in this forum
and I am sure that you will get an answer to most problems. You can also
search here
http://groups.google.com/advanced_search?q=&
put this
microsoft.public.access
in the box "Return only messages from the group at this location"
then type a few key words into the top box
Good luck with your project

Signature
Wayne
Manchester, England.
> Wahhoooo.
>
[quoted text clipped - 63 lines]
> > > >
> > > > Anton Cini