Can't insert records - Validation Rules
Hi, I'm trying to insert data and am getting the following error:
'Microsoft Office Access can't append all the records in the append query.
blah, blah ... and 1 record(s) due to validation rule violations'
The problem is due to a field (that I'm not setting in the insert query) that has a Validation Rule in the table design. The values in this field are only allowed to be 2011, 2013, or <null> (as in nothing; not a 6 character string including angle brackets). When I remove the rule, the insert works fine, when it is there, the error appears.
I have 2 questions:
1) Having been bitten by table lookup fields in table designs, I'm wary of any shortcuts gained by using the features in the table design area, but setting the validation rule seemed good practise. Should I keep the rule here, or just enforce it in vba at insert time?
2) Assuming i keep the rule, what is the correct syntax to type in the Field Properties section to allow the field in question to not have any data following an insert. I've tried:
with no success
{ok 2-1/2 questions}. Following on from q2, is there a way to print the make table sql (ddl?) that would create the table so I can see the syntax generated by my fumbling in the property box?
cheers & tia
mcalex
Hi, I'm trying to insert data and am getting the following error:
'Microsoft Office Access can't append all the records in the append query.
blah, blah ... and 1 record(s) due to validation rule violations'
The problem is due to a field (that I'm not setting in the insert query) that has a Validation Rule in the table design. The values in this field are only allowed to be 2011, 2013, or <null> (as in nothing; not a 6 character string including angle brackets). When I remove the rule, the insert works fine, when it is there, the error appears.
I have 2 questions:
1) Having been bitten by table lookup fields in table designs, I'm wary of any shortcuts gained by using the features in the table design area, but setting the validation rule seemed good practise. Should I keep the rule here, or just enforce it in vba at insert time?
2) Assuming i keep the rule, what is the correct syntax to type in the Field Properties section to allow the field in question to not have any data following an insert. I've tried:
Code:
2011 Or 2013 Or Is Null
=2011 Or 2013 Or Is Null
=2011 Or =2013 Or Is Null
=(2011 Or 2013) Or Is Null
{ok 2-1/2 questions}. Following on from q2, is there a way to print the make table sql (ddl?) that would create the table so I can see the syntax generated by my fumbling in the property box?
cheers & tia
mcalex
Last edited: