If statements

  • Thread starter Thread starter mju
  • Start date Start date
M

mju

I need serious help. I am new to Access. I am trying to write up an if
statement.

I have a query and a report setup. What I am trying to do is whenever a
report is ran or data is enter, if ClientPrintDoc = 0 then Jobprice should be
=0
I tried putting the formula in the query view criteria section but I got an
error stating the following:
You cannot specify criteria for the (*)
This is my formula:
=IIf("ClientShipDocs"="0","JobPrice"="0")
Is this formula actually correct? Do I need a macro for this? If yes, how
do I proceed?

Thanks a lot!!
 
=IIf("ClientShipDocs"="0","JobPrice"="0") Is this formula actually
correct?
No. JobPrice: IIf([ClientShipDocs] = 0,0, but you need some value here
for JobPrice if ClientShipDocs is not zero)


Do I need a macro for this?
 
Thanks.

i want it to take the default set price if clientshipdocs is not zero. I
have a separate table for jobprice.

Do i put this in the criteria section of the *query?
IIf([ClientShipDocs] = 0,0,

thanks Alot!
KARL DEWEY said:
correct?
No. JobPrice: IIf([ClientShipDocs] = 0,0, but you need some value here
for JobPrice if ClientShipDocs is not zero)


Do I need a macro for this?

mju said:
I need serious help. I am new to Access. I am trying to write up an if
statement.

I have a query and a report setup. What I am trying to do is whenever a
report is ran or data is enter, if ClientPrintDoc = 0 then Jobprice should be
=0
I tried putting the formula in the query view criteria section but I got an
error stating the following:
You cannot specify criteria for the (*)
This is my formula:
=IIf("ClientShipDocs"="0","JobPrice"="0")
Is this formula actually correct? Do I need a macro for this? If yes, how
do I proceed?

Thanks a lot!!
 
Maybe I am just slow today but I do not understand what you are trying to
accomplish. You say you a separate table for jobprice. How does that
relate here?

Maybe if you post the SQL of your query it might be clearer.

mju said:
Thanks.

i want it to take the default set price if clientshipdocs is not zero. I
have a separate table for jobprice.

Do i put this in the criteria section of the *query?
IIf([ClientShipDocs] = 0,0,

thanks Alot!
KARL DEWEY said:
=IIf("ClientShipDocs"="0","JobPrice"="0") Is this formula actually
correct?
No. JobPrice: IIf([ClientShipDocs] = 0,0, but you need some value here
for JobPrice if ClientShipDocs is not zero)


Do I need a macro for this?

mju said:
I need serious help. I am new to Access. I am trying to write up an if
statement.

I have a query and a report setup. What I am trying to do is whenever a
report is ran or data is enter, if ClientPrintDoc = 0 then Jobprice should be
=0
I tried putting the formula in the query view criteria section but I got an
error stating the following:
You cannot specify criteria for the (*)
This is my formula:
=IIf("ClientShipDocs"="0","JobPrice"="0")
Is this formula actually correct? Do I need a macro for this? If yes, how
do I proceed?

Thanks a lot!!
 
Mju,

I think there is a misunderstanding here. The purpose of a Query is to
return a set of records based on the data in the query's underlying
table(s). And the purpose of Criteria in a query is to restrict the records
returned by the query according to the value of the data in the field that
the criteria is applied to.

This does not appear to be what you are trying to do.

Karl interpreted your request for a value to be output by the query based on
the value of another filed, so he has provided an example for a calculated
field within the query.

But this does not appear to be what you want either. You appear to be
wanting to assign a value to one field in a record, according to the value
of another field in a record, and the value assigned will be in accordance
with the values found in yet another table. Am I sort of right?

It is probably possible to do this on your form using a macro with a
SetValue action. But I don't think that would be a good approach. More
likely you would use an Update Query. And if you wanted to automate this,
it could be done via a macro using an OpenQuery action to run the update.

Beyond that, I would need a more explicit description of what you want to
achieve, with specific examples, before I could comment in more detail.

--
Steve Schapel, Microsoft Access MVP


mju said:
I need serious help. I am new to Access. I am trying to write up an if
statement.

I have a query and a report setup. What I am trying to do is whenever a
report is ran or data is enter, if ClientPrintDoc = 0 then Jobprice should
be
=0
I tried putting the formula in the query view criteria section but I got
an
error stating the following:
You cannot specify criteria for the (*)
This is my formula:
=IIf("ClientShipDocs"="0","JobPrice"="0")
Is this formula actually correct? Do I need a macro for this? If yes, how
do I proceed?

Thanks a lot!!



__________ Information from ESET Smart Security, version of virus signature database 4164 (20090617) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Back
Top