Line Break

D

DS

I can't seem to break this into two lines...also is there a better, or
shorter way to code this?
Thanks
DS

Me.TxtNone = Round(IIf(CDTaxCodeID = 2,
Nz(DSum("(CDQuantity*CDFinalPrice)/(1+CDTaxRate)", "tblCheckDetailsTMP",
"CDCheckID = " & Forms!Form2!TxtCheckID & " AND CDDiscountDP = 0 AND
CDTaxCodeID = 2"), 0), _
Nz(DSum("CDQuantity*CDFinalPrice", "tblCheckDetailsTMP", "CDCheckID = " &
Forms!Form2!TxtCheckID & " AND CDDiscountDP = 0 AND CDTaxCodeID <>2"), 0),
1))
 
K

Klatuu

You have a line continuation character _
already in the code. Are you getting an error?
Can you provide more detail, please?
 
D

DS

A short version,
Me.TxtField = DSum("Field","tblAll") + DSum("Field","tblSome")

This is too long so to view so I want to put the DSums on seperate lines.

Me.TxtField = DSum("Field","tblAll")
+ DSum("Field","tblSome")

How would I do this?
Thanks
DS
 
K

Klatuu

Me.TxtField = DSum("Field","tblAll") _
+ DSum("Field","tblSome")

But I still don't see the problem with the long version. As I said, you
already have the line continuation character.

I can't very well help if you wont say what the problem is.
 
K

Klatuu

Syntax is incorrect. See if this works.

Me.TxtNone = Round(IIf(CDTaxCodeID = 2,
Nz(DSum("CDQuantity*CDFinalPrice)/(1+CDTaxRate)", "tblCheckDetailsTMP",
"CDCheckID = " & Forms!Form2!TxtCheckID & " AND CDDiscountDP = 0 AND
CDTaxCodeID = 2"), 0), _
Nz(DSum("CDQuantity*CDFinalPrice", "tblCheckDetailsTMP", "CDCheckID = " &
Forms!Form2!TxtCheckID & " AND CDDiscountDP = 0 AND CDTaxCodeID <>2"), 0),
1))
 
K

Klatuu

Me.TxtNone = Round(IIf(CDTaxCodeID = 2, _
Nz(DSum("CDQuantity*CDFinalPrice)/(1+CDTaxRate)", "tblCheckDetailsTMP", _
"CDCheckID = " & Forms!Form2!TxtCheckID & _
" AND CDDiscountDP = 0 AND CDTaxCodeID = 2"), 0), _
Nz(DSum("CDQuantity*CDFinalPrice", "tblCheckDetailsTMP", "CDCheckID = "
& _
Forms!Form2!TxtCheckID & " AND CDDiscountDP = 0 AND CDTaxCodeID <>2"),
0), 1))
 

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

Similar Threads

Using INT() 5
Function Returns 0 3
DSum Wrong Argument 2
Two D Statemnets 4
Form Reference 5
SQL Rowsource 1
DSum Problem 2
Union Query Format 6

Top