IF Statement Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been unsuccessfully trying to create the following code from Excel
into VB for an Access report. Can someone please help?
Thank you,
Liz
 
Liz Steffen said:
I have been unsuccessfully trying to create the following code from Excel
into VB for an Access report. Can someone please help?
Thank you,
Liz

Try this:

IIf(_sold-volume>0,IIf(_onhand-volume<_sold-volume,_onhand-volume,_sold-volume),0)Tom Lake
 
I put your code directly into the field on my Access report and it prompts me
to input the Sales Volume and OnHand Volume values, but those are coming from
the query. Can you offer me more help?
 
Liz Steffen said:
I put your code directly into the field on my Access report and it prompts
me
to input the Sales Volume and OnHand Volume values, but those are coming
from
the query. Can you offer me more help?

The report's data source IS the query, right?

Don't forget the =

=
IIf(_sold-volume>0,IIf(_onhand-volume<_sold-volume,_onhand-volume,_sold-volume),0)


Tom Lake
 
Yes, I figured this one out, I appreciate your help on it, I couldn't have
done it without your code. However, now, when I put in a Total field for
that field that has the IIF statment, it is prompting me for a parameter and
when I don't put one in, it doesn't do the sum. Can you not sum a field that
does a calculation?
 
Yeah, but this one's complex. You need to put the whole formula into the
source data for the control, like this: =Sum(IIf(_sold-volume>0,IIf(_onhand-
volume<_sold-volume,_onhand-volume,_sold-volume),0))

HTH

Liz said:
Yes, I figured this one out, I appreciate your help on it, I couldn't have
done it without your code. However, now, when I put in a Total field for
that field that has the IIF statment, it is prompting me for a parameter and
when I don't put one in, it doesn't do the sum. Can you not sum a field that
does a calculation?[quoted text clipped - 10 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top