ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Null, "null", vbNull, vbNullString, vbEmpty (https://www.excelbanter.com/excel-programming/368223-null-null-vbnull-vbnullstring-vbempty.html)

[email protected]

Null, "null", vbNull, vbNullString, vbEmpty
 
Hi,

if I am writing VBA code in MS EXCEL to insert 'nulls' into certain
cells,
so that when I import that into MS Access I can run queries with the
filter criteria such as

SELECT *
FROM blah
WHERE column Is Not Null

Then which Null do i use?

cell.Value = Null ?
cell.Value = "Null" ?
cell.Value = vbNull ?
cell.Value = vbNullString ?
cell.Value = vbEmpty ?


I'm all nulled crazy ...hehe. :)


Harald Staff

Null, "null", vbNull, vbNullString, vbEmpty
 
Excel cells can't afaik contain NULL. They will be either zero or an empty
string (which behaves like zero in Excel's calculations).

HTH. Best wishes Harald

skrev i melding
oups.com...
Hi,

if I am writing VBA code in MS EXCEL to insert 'nulls' into certain
cells,
so that when I import that into MS Access I can run queries with the
filter criteria such as

SELECT *
FROM blah
WHERE column Is Not Null

Then which Null do i use?

cell.Value = Null ?
cell.Value = "Null" ?
cell.Value = vbNull ?
cell.Value = vbNullString ?
cell.Value = vbEmpty ?


I'm all nulled crazy ...hehe. :)




Dave Peterson

Null, "null", vbNull, vbNullString, vbEmpty
 
I don't speak the Access or the SQL, but in VBA these are almost equivalent:

cell.value = ""
cell.clearcontents

About the only time I've noticed a difference is when I'm dealing with merged
cells (yech!!!).



wrote:

Hi,

if I am writing VBA code in MS EXCEL to insert 'nulls' into certain
cells,
so that when I import that into MS Access I can run queries with the
filter criteria such as

SELECT *
FROM blah
WHERE column Is Not Null

Then which Null do i use?

cell.Value = Null ?
cell.Value = "Null" ?
cell.Value = vbNull ?
cell.Value = vbNullString ?
cell.Value = vbEmpty ?

I'm all nulled crazy ...hehe. :)


--

Dave Peterson


All times are GMT +1. The time now is 04:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com