View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
George Nicholson[_2_] George Nicholson[_2_] is offline
external usenet poster
 
Posts: 170
Default Access and Excel VBA

Within a SQL string
"...[Proj Number] Is Null..."
or
"...[Proj Number] Is Not Null..."
would be correct syntax and would work.
(This is the correct syntax when you are building a SQL string in VB)

However, if you are testing a field in VB code, that syntax won't work. You
need to use the IsNull function.
"If IsNull([ProjNumber]) Then"
or
"If Not IsNull([ProjNumber]) Then"
or
"If IsNull([ProjNumber]) = True Then"
(etc) would work in VB.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"ibeetb" wrote in message
...
I am attempting to load data in my excel sprsht from an Access DB and I can
load in all fields from Access EXCEPT those that say something
like:[Projects to Exclude]. [Proj Number] Is Null....
In a nutshell, I have another table called [Projects]. Then I have a table
called :[Projects to Exclude]. I want all the records from [projects]
where the [proj number] field Is Null in the [Projects to Exclude].

I get lots of data if I say [Proj Number] Is Not Null. It brings in all
the records I DON'T want.....but I want the records that are NOT in the
[Projects to Exclude] table.....
Also, in my VB Editor in Excel, I have it written as ([Projects to
Exclude].[proj number]) Is Null
I don't have quotes or anything around Is Null....as it gave me an
error.....
Any ideas?