Zeroanarchy
Technical User
I am hoping someone might be able to help me with this I have been pulling my hair out for days.
I am getting the following error on running my append query:
and 2 record(s)due to validation rule violations.
How it works, it imports one table into another and if the fields are blank then it assigns a value to the blank field, now when I run this under a select query it looks great but for some reason I get an error on the append.
Here is the code: and if anyone has fives min I would be happy to send you a copy to look at.
INSERT INTO Regestration ( parkcode, drainageline, roadsideinfestation, Loginname, Northings, Eastings, infestedarea, riskrating, vegetationtype, soil, monthtobetreated, commonlocationname, dateregistered, speconstraints, specialconsiderations, Logindate, lifecycle, strata, Yeartobetreated )
SELECT IIf(IsNull([hhreg].[parkcode]) Or ([hhreg].[parkcode]="",0,[hhreg].[parkcode]) AS Expr1, HHreg.drainageline, HHreg.roadsideinfestation, "HandHeld" AS Expr15, Left([Northings],8) AS Expr19, Left([Eastings],8) AS Expr20, IIf(IsNull([hhreg].[infestedarea]) Or ([hhreg].[infestedarea]="",0,[hhreg].[infestedarea]) AS Expr3, IIf(IsNull([hhreg].[riskrating]) Or ([hhreg].[riskrating]="","NoneSet",[hhreg].[riskrating]) AS Expr4, IIf(IsNull([hhreg].[vegetationtype]) Or ([hhreg].[vegetationtype]="","NoneSet",[hhreg].[vegetationtype]) AS Expr5, IIf(IsNull([hhreg].[soil]) Or ([hhreg].[soil]="","NonetSet",[hhreg].[soil]) AS Expr6, IIf(IsNull([hhreg].[monthtobetreated]) Or ([hhreg].[monthtobetreated]="","January",[hhreg].[monthtobetreated]) AS Expr7, IIf(IsNull([hhreg].[commonlocationname]) Or ([hhreg].[commonlocationname]="","NoneSet",[hhreg].[commonlocationname]) AS Expr9, IIf(IsNull([hhreg].[dateregistered]) Or ([hhreg].[dateregistered]="",Date(),[hhreg].[dateregistered]) AS Expr10, IIf(IsNull([hhreg].[speconstraints]) Or ([hhreg].[speconstraints]="","None",[hhreg].[speconstraints]) AS Expr13, IIf(IsNull([hhreg].[specialconsiderations]) Or ([hhreg].[specialconsiderations]="","None",[hhreg].[specialconsiderations]) AS Expr14, IIf(IsNull([hhreg].[logindate]) Or ([hhreg].[logindate]="",Now(),[hhreg].[logindate]) AS Expr16, IIf(IsNull([hhreg].[lifecycle]) Or ([hhreg].[lifecycle]="","NoneSet",[hhreg].[lifecycle]) AS Expr17, IIf(IsNull([hhreg].[strata]) Or ([hhreg].[strata]="","NoneSet",[hhreg].[strata]) AS Expr18, IIf(IsNull([hhreg].[yeartobetreated]) Or ([hhreg].[yeartobetreated]="","2003",[hhreg].[yeartobetreated]) AS Expr8
FROM HHreg;
Zeroanarchy Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.
I am getting the following error on running my append query:
and 2 record(s)due to validation rule violations.
How it works, it imports one table into another and if the fields are blank then it assigns a value to the blank field, now when I run this under a select query it looks great but for some reason I get an error on the append.
Here is the code: and if anyone has fives min I would be happy to send you a copy to look at.
INSERT INTO Regestration ( parkcode, drainageline, roadsideinfestation, Loginname, Northings, Eastings, infestedarea, riskrating, vegetationtype, soil, monthtobetreated, commonlocationname, dateregistered, speconstraints, specialconsiderations, Logindate, lifecycle, strata, Yeartobetreated )
SELECT IIf(IsNull([hhreg].[parkcode]) Or ([hhreg].[parkcode]="",0,[hhreg].[parkcode]) AS Expr1, HHreg.drainageline, HHreg.roadsideinfestation, "HandHeld" AS Expr15, Left([Northings],8) AS Expr19, Left([Eastings],8) AS Expr20, IIf(IsNull([hhreg].[infestedarea]) Or ([hhreg].[infestedarea]="",0,[hhreg].[infestedarea]) AS Expr3, IIf(IsNull([hhreg].[riskrating]) Or ([hhreg].[riskrating]="","NoneSet",[hhreg].[riskrating]) AS Expr4, IIf(IsNull([hhreg].[vegetationtype]) Or ([hhreg].[vegetationtype]="","NoneSet",[hhreg].[vegetationtype]) AS Expr5, IIf(IsNull([hhreg].[soil]) Or ([hhreg].[soil]="","NonetSet",[hhreg].[soil]) AS Expr6, IIf(IsNull([hhreg].[monthtobetreated]) Or ([hhreg].[monthtobetreated]="","January",[hhreg].[monthtobetreated]) AS Expr7, IIf(IsNull([hhreg].[commonlocationname]) Or ([hhreg].[commonlocationname]="","NoneSet",[hhreg].[commonlocationname]) AS Expr9, IIf(IsNull([hhreg].[dateregistered]) Or ([hhreg].[dateregistered]="",Date(),[hhreg].[dateregistered]) AS Expr10, IIf(IsNull([hhreg].[speconstraints]) Or ([hhreg].[speconstraints]="","None",[hhreg].[speconstraints]) AS Expr13, IIf(IsNull([hhreg].[specialconsiderations]) Or ([hhreg].[specialconsiderations]="","None",[hhreg].[specialconsiderations]) AS Expr14, IIf(IsNull([hhreg].[logindate]) Or ([hhreg].[logindate]="",Now(),[hhreg].[logindate]) AS Expr16, IIf(IsNull([hhreg].[lifecycle]) Or ([hhreg].[lifecycle]="","NoneSet",[hhreg].[lifecycle]) AS Expr17, IIf(IsNull([hhreg].[strata]) Or ([hhreg].[strata]="","NoneSet",[hhreg].[strata]) AS Expr18, IIf(IsNull([hhreg].[yeartobetreated]) Or ([hhreg].[yeartobetreated]="","2003",[hhreg].[yeartobetreated]) AS Expr8
FROM HHreg;
Zeroanarchy Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.