MS Access error when connected to ODBC
Asked Answered
A

2

4

When attempting to add a line in MS Access 2010 in a field which is Varchar not null i am getting the error "you tried to assign the Null value to a variable that is not a variant data type"

I am using an ODBC connection from an sql database which allows the empty value in the table but not when trying to add rows in access

I believe this to have been a common fault in 2007 from what i have read?

Firstly does anyone know if there is a simple work around for this problem?

Secondly I can't see a patch for this on the microsoft website i am currently using office 2010 professional plus version 14.0.7015.1000

Aneroid answered 5/3, 2014 at 16:20 Comment(0)
C
4

In Access, when entering a value "directly" into a table (either in Datasheet View or in a bound form), simply leaving the cell/control empty will attempt to insert a NULL value. If the corresponding column in the underlying table does not allow NULL values then the insert will fail.

The workaround for that is to type

""

into the cell/control to specify an empty string (which is not the same as a NULL value). I just tested this on an ODBC linked table against SQL Server 2008 R2 from Access 2010 and it worked.

Carousal answered 5/3, 2014 at 16:35 Comment(1)
Hey Thompson , this was being used for our process similarly with Access to SQL Server , but now it seems like only one entry is not accepting the "" while rest of the rows are good , only one row is not accepting and throwing out an errorBerger
U
0

user2615341, it seems that MS SQL Server jumps in before any other event can be triggered (BeforeUpdate/Click/LostFocus...). My personal experience leads me to suggest you that you have to build a proxy type/class and work with a disconnected form if you want to have full control of what's happening.

Underexposure answered 26/7, 2017 at 15:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.