Solved #Type and #Error in Textboxes (2 Viewers)

tmyers

Well-known member
Local time
Yesterday, 19:27
Joined
Sep 8, 2020
Messages
1,090
I am hoping someone with a keener eye can tell me where I need to put the IIF(ISERROR()) in these two expressions to suppress the errors from appearing on the form. The form in question is a continuous form and the last row displays these errors (no record). Does it effect anything? No. Is it ugly to display? Absolutely.

First Textbox:
=IIf(IsNull([UnitCost])=True,0,[UnitCost])+IIf(IsNull(Nz(DSum("TotalAdder","QryAdderTotals","ID_Fixture = " & [Forms]![frmJob]![frmQuoteContainer].[Form]![FixtureID]),0))=True,0,Nz(DSum("TotalAdder","QryAdderTotals","ID_Fixture = " & [Forms]![frmJob]![frmQuoteContainer].[Form]![FixtureID]),0))

Second:
=IIf(IsError([TotalUnitTxt]*[Qty])=True,"",[TotalUnitTxt]*[Qty])
Even though I have the IsError in there, this one still returns #Type.


Edit:
While I didn't fix the expressions from showing the errors, simply turning the forms allow additions property to false made that row no longer show. Since the form in question isn't designed for adding records, making that change will work. Sorry for the post :(
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:27
Joined
May 21, 2018
Messages
8,529
That nested iif is ugly and is a lot of time wasted trying to create a calculated control.

NZ basically has an imbedded if. If nz then return a value else leave it.
IIf(IsNull([UnitCost])=True,0,[UnitCost])
is simply
nz([UnitCost]),0)

so your iif is simply
nz([UnitCost]),0)+
Nz(DSum("TotalAdder","QryAdderTotals","ID_Fixture = " & [Forms]![frmJob]![frmQuoteContainer].[Form]![FixtureID]),0)

Also any functions starting with IS returns true or false

if IsNull(X) = true then ...
is simply
if isNull(x) then

because
If true = true is the same as if true

Also IMO doing this is a calculated field is a PITA. Do the NZ in the query to start with. Create a field in the Query CleanUnitCost: NZ([unitCost],0)
Make another query That gets the Sums grouped by ID_Fixture. You can reference that or show as as subform.
 
Last edited:

Users who are viewing this thread

Top Bottom