Link to home
Start Free TrialLog in
Avatar of Taras
TarasFlag for Canada

asked on

Append Null to date/time field

I am appending records from one table to another
And I am getting error that records are not appended because of validation rule error.


In table tblMasterRep Date filed is date/time filed type
In table for this field there is no option for allow Null value or not.

In table tblArchivedMaster Date filed is date/time type and could have null value.


Here is my query:

INSERT INTO tblMasterRep ( [DATE] )
SELECT IIf(IsNull([DATE]),Null,[DATE])
FROM tblArchivedMaster;

I tried with : IIf(IsNull([DATE]),”Null”,[DATE])
 Not working

Any Idea?
Avatar of Member_2_276102
Member_2_276102

Instead of using Null or ”Null”, try an actual valid date like "01/01/0001". Use some date that cannot be confused with a 'real' date.

If a null value is valid in the tblArchivedMaster table, the real answer should be that tblMasterRep should also allow null values. But if that cannot be changed, you'll need to use a value that will pass validation and that you can still recognize as a substitute for a null value.

Tom
Avatar of mbizup
Are you dealing with an Access table?  You should be able to directly insert nulls...

Check the validation rules and required properties in your table design.
FieldProperties.png
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial