
Originally Posted by
John_G
Hi -
When entering data in a form, entering only blanks in a field, or deleting the contents results in a Null for the field; there is no way of entering a zero-length string into a control, unless you use VBA.
In table design view, check the setting of Allow Zero Length for the Middle Initial; unless you changed it, it probably is set to NO, meaning the zero-length string - "" - is not allowed. It's important to note that the zero-length string is not Null.
Now, what's happening to generate all those errors is that the Trim function, when applied to an all-blank (or zero-length) field coming from Excel, results in in a zero-length string, which is not valid.
Here's what you can try:
Either change the Allow Zero Length property to Yes, so at least you can get all the data in without errors, or
Modify your (update?) query to replace blank strings with nulls: iif(len(trim([Initial])) = 0, Null, [Initial]) so that you will have no zero-length strings.
The second option might be better, as your null tests will work as expected.
I know the differences between zero-length string and Null can be hard to grasp - it's sort of like asking "When is nothing not nothing?" - I've been there too.
HTH a bit!
John