Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top