Right syntax, wrong results

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

Guest

I'm using the following syntax to show the current weight shipped for a PO,
if there is a contract weight assigned. If there is no contract weight
assigned to the PO, it should be blank.

=IIf(IsNull([Contract Weight])," ",Sum([Weight])/2240 & " G/T")

All is good and everything works like it should, except it shows this on the
report

207.9642857142

What I want to see is 207 G/T. I set the decimal place to 0 on the report
and in the table for this field. But still same results. What am I missing on
the format?

Thanks.
 
I'm using the following syntax to show the current weight shipped for a PO,
if there is a contract weight assigned. If there is no contract weight
assigned to the PO, it should be blank.

=IIf(IsNull([Contract Weight])," ",Sum([Weight])/2240 & " G/T")

All is good and everything works like it should, except it shows this on the
report

207.9642857142

What I want to see is 207 G/T. I set the decimal place to 0 on the report
and in the table for this field. But still same results. What am I missing on
the format?

Thanks.

=IIf(IsNull([Contract Weight])," ",Int(Sum([Weight])/2240) & " G/T")
 
Thanks Fred!

Hey, I had to make a change and now I need to pull [weight] from the table
'Main'.

I tried the following syntax which is not working:

=IIf(IsNull([Contract Weight])," ",Int(Sum([Main]![Weight])/2240 & " G/T")

I can't add the 'Main' table to the query where this report is pulling it's
info from because it messes up another function of that query.

Thanks.

fredg said:
I'm using the following syntax to show the current weight shipped for a PO,
if there is a contract weight assigned. If there is no contract weight
assigned to the PO, it should be blank.

=IIf(IsNull([Contract Weight])," ",Sum([Weight])/2240 & " G/T")

All is good and everything works like it should, except it shows this on the
report

207.9642857142

What I want to see is 207 G/T. I set the decimal place to 0 on the report
and in the table for this field. But still same results. What am I missing on
the format?

Thanks.

=IIf(IsNull([Contract Weight])," ",Int(Sum([Weight])/2240) & " G/T")
 
Thanks Fred!

Hey, I had to make a change and now I need to pull [weight] from the table
'Main'.

I tried the following syntax which is not working:

=IIf(IsNull([Contract Weight])," ",Int(Sum([Main]![Weight])/2240 & " G/T")

I can't add the 'Main' table to the query where this report is pulling it's
info from because it messes up another function of that query.

Thanks.

fredg said:
I'm using the following syntax to show the current weight shipped for a PO,
if there is a contract weight assigned. If there is no contract weight
assigned to the PO, it should be blank.

=IIf(IsNull([Contract Weight])," ",Sum([Weight])/2240 & " G/T")

All is good and everything works like it should, except it shows this on the
report

207.9642857142

What I want to see is 207 G/T. I set the decimal place to 0 on the report
and in the table for this field. But still same results. What am I missing on
the format?

Thanks.

=IIf(IsNull([Contract Weight])," ",Int(Sum([Weight])/2240) & " G/T")

If the field is not in the query, you need to use the DSUM() function
to get the correct amount.

=IIf(IsNull([Contract Weight])," "Int(DSum("[Weight]","[Main]")/2240)
& " G/T")

Note the positioning of all the parentheses. You left one off, after
the 2240, in your message.

If there is any criteria involved in summing the records, you'll need
to add a where clause to restrict the data.
See VBA help on
DSum()
 
Thanks Fred, you are the man.

I'm trying to gain a better understanding on the parentheses, where they
fall, and why.

fredg said:
Thanks Fred!

Hey, I had to make a change and now I need to pull [weight] from the table
'Main'.

I tried the following syntax which is not working:

=IIf(IsNull([Contract Weight])," ",Int(Sum([Main]![Weight])/2240 & " G/T")

I can't add the 'Main' table to the query where this report is pulling it's
info from because it messes up another function of that query.

Thanks.

fredg said:
On Thu, 20 Jan 2005 09:15:05 -0800, Tugger wrote:

I'm using the following syntax to show the current weight shipped for a PO,
if there is a contract weight assigned. If there is no contract weight
assigned to the PO, it should be blank.

=IIf(IsNull([Contract Weight])," ",Sum([Weight])/2240 & " G/T")

All is good and everything works like it should, except it shows this on the
report

207.9642857142

What I want to see is 207 G/T. I set the decimal place to 0 on the report
and in the table for this field. But still same results. What am I missing on
the format?

Thanks.

=IIf(IsNull([Contract Weight])," ",Int(Sum([Weight])/2240) & " G/T")

If the field is not in the query, you need to use the DSUM() function
to get the correct amount.

=IIf(IsNull([Contract Weight])," "Int(DSum("[Weight]","[Main]")/2240)
& " G/T")

Note the positioning of all the parentheses. You left one off, after
the 2240, in your message.

If there is any criteria involved in summing the records, you'll need
to add a where clause to restrict the data.
See VBA help on
DSum()
 
Back
Top