Setting Null to save in the Database

T

tarunbajaj

I am building a Insert statement using VBA Macro for excel.
In a situation my value in the Range is 0, I want to insert a Null in
the database.
I have Dim intVal As Integer but I cannot set it to Null
Later I also need to put this in a string which I can execute.
Please advice.
Thanks
Tarun Bajaj
 
C

Cindy M -WordMVP-

I am building a Insert statement using VBA Macro for excel.
In a situation my value in the Range is 0, I want to insert a Null in
the database.
I have Dim intVal As Integer but I cannot set it to Null
Later I also need to put this in a string which I can execute.
Null isn't an integer, or a string. Null is the state of an
uninstantiaged object. In my experience, it's not possible to change
the value of a database field to Null. A database field may evaluate to
Null if it's never contained a value (never been instantiated), but I
don't think you can change it back to Null. May depend on the database,
though. I think your first step needs to be finding out if your
database supports that, and if it does, what the ADO syntax is for
making the setting.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top