Trying to eliminate #ERROR I use this code but it does not work.

L

ldiaz

what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it needs to
return 0.

please help.
 
J

Jeanette Cunningham

ldiaz,
if the subform has no data, then access can't work out if the qty = 0 or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham
 
L

ldiaz

I forgot to tell that:
on the field that I'm trying to get the sum is named:
SumQtyFrm1 and it's placed on the form footer
now I fixed the problem in the subform with this code,
=IIf([Qty]=0,0,Sum([Qty]))
but i'm still getting the same issue (#Error) in my form named:
frm_Shipping_System on the field named:Qtyfromfrm1 where I have this code:
=((sfrm_Shipment_SystemforFrm1.Form!SumQtyfrm1))


could you please help on this..



--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
ldiaz,
if the subform has no data, then access can't work out if the qty = 0 or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham

ldiaz said:
what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it needs to
return 0.

please help.
 
J

Jeanette Cunningham

Lorenzo,

If the text box on the main form is called txtQuantity

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = [Form].[SumQtyfrm1]
End If
End With

Jeanette Cunningham

ldiaz said:
I forgot to tell that:
on the field that I'm trying to get the sum is named:
SumQtyFrm1 and it's placed on the form footer
now I fixed the problem in the subform with this code,
=IIf([Qty]=0,0,Sum([Qty]))
but i'm still getting the same issue (#Error) in my form named:
frm_Shipping_System on the field named:Qtyfromfrm1 where I have this code:
=((sfrm_Shipment_SystemforFrm1.Form!SumQtyfrm1))


could you please help on this..



--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
ldiaz,
if the subform has no data, then access can't work out if the qty = 0 or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham

ldiaz said:
what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it needs
to
return 0.

please help.
 
L

ldiaz

how can I use your code if i'm using the formula in the source field

where it needs to go?


Thanks
--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
Lorenzo,

If the text box on the main form is called txtQuantity

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = [Form].[SumQtyfrm1]
End If
End With

Jeanette Cunningham

ldiaz said:
I forgot to tell that:
on the field that I'm trying to get the sum is named:
SumQtyFrm1 and it's placed on the form footer
now I fixed the problem in the subform with this code,
=IIf([Qty]=0,0,Sum([Qty]))
but i'm still getting the same issue (#Error) in my form named:
frm_Shipping_System on the field named:Qtyfromfrm1 where I have this code:
=((sfrm_Shipment_SystemforFrm1.Form!SumQtyfrm1))


could you please help on this..



--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
ldiaz,
if the subform has no data, then access can't work out if the qty = 0 or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham

what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it needs
to
return 0.

please help.
 
J

Jeanette Cunningham

Lorenzo,
you're right, that doesn't work as a control source.
Try the function called IsError from The access web.

http://www.mvps.org/access/forms/frm0022.htm

Jeanette Cunningham

ldiaz said:
how can I use your code if i'm using the formula in the source field

where it needs to go?


Thanks
--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
Lorenzo,

If the text box on the main form is called txtQuantity

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = [Form].[SumQtyfrm1]
End If
End With

Jeanette Cunningham

ldiaz said:
I forgot to tell that:
on the field that I'm trying to get the sum is named:
SumQtyFrm1 and it's placed on the form footer
now I fixed the problem in the subform with this code,
=IIf([Qty]=0,0,Sum([Qty]))
but i'm still getting the same issue (#Error) in my form named:
frm_Shipping_System on the field named:Qtyfromfrm1 where I have this
code:
=((sfrm_Shipment_SystemforFrm1.Form!SumQtyfrm1))


could you please help on this..



--
Lorenzo Díaz
Cad Technician


:

ldiaz,
if the subform has no data, then access can't work out if the qty = 0
or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham

what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it
needs
to
return 0.

please help.
 
L

ldiaz

Great!

with your help I have fixed the issue.

Thanks
--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
Lorenzo,
you're right, that doesn't work as a control source.
Try the function called IsError from The access web.

http://www.mvps.org/access/forms/frm0022.htm

Jeanette Cunningham

ldiaz said:
how can I use your code if i'm using the formula in the source field

where it needs to go?


Thanks
--
Lorenzo Díaz
Cad Technician


Jeanette Cunningham said:
Lorenzo,

If the text box on the main form is called txtQuantity

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = [Form].[SumQtyfrm1]
End If
End With

Jeanette Cunningham


I forgot to tell that:
on the field that I'm trying to get the sum is named:
SumQtyFrm1 and it's placed on the form footer
now I fixed the problem in the subform with this code,
=IIf([Qty]=0,0,Sum([Qty]))
but i'm still getting the same issue (#Error) in my form named:
frm_Shipping_System on the field named:Qtyfromfrm1 where I have this
code:
=((sfrm_Shipment_SystemforFrm1.Form!SumQtyfrm1))


could you please help on this..



--
Lorenzo Díaz
Cad Technician


:

ldiaz,
if the subform has no data, then access can't work out if the qty = 0
or
not.
try something like this:

With Me.sfrm_Shipment_SystemforFrm1
If .RecordsetClone.RecordCount = 0 then
Me.txtQuantity = 0
Else
Me.txtQuantity = IIf([.[Form].[Qty] = 0, 0, Sum[Qty])
End If
End With

Jeanette Cunningham

what is wrong with my code?
=IIf([sfrm_Shipment_SystemforFrm1].[Form].[Qty] = 0, 0, Sum[Qty])

my subform name is: sfrm_Shipment_SystemforFrm1
my field: Qty

I'm trying to sum Qty but if there is no data on the subform it
needs
to
return 0.

please help.
 
Top