Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Access and Excel VBA

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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
Access data -work in Excel- save in Access s_u_resh Excel Programming 1 October 25th 04 12:52 PM
Getting Access Error Messages when running Access through Excel Dkline[_2_] Excel Programming 0 October 12th 04 09:35 PM


All times are GMT +1. The time now is 10:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"