Can't get SQL query to work with OLE DB

D

Dave

I am trying to query MS-Project to pull Tasks with a specific
TaskOutlineCode3 value. So I set up a connection string as:

conData.ConnectionString =
"Provider=Microsoft.Project.OLEDB.10.0;PROJECT NAME=" & File_Name

I am able to open the connection and I have written several queries that
work as I expect. So far works great.

However, whenever I try to query the Tasks table with a WHERE condition for
a field that is of type Text, it doesn't return any values. For Example

strSelect = "SELECT * FROM Tasks WHERE Taskname Like '*'
rstResources.Open strSelect, conData
Do While Not rstResources.EOF
Debug.Print rstResources![TaskID]
Loop

This returns 0 records, even though I have plenty of records with Tasknames.
What am I doing wrong? Is this a bug? I am running MS-Project 2002

Any help would be greatly appreciated....
Dave
 
R

Rod Gill

If you read the prjoledb.htm file carefully you will see that the ANY, LIKE,
and IS NOT operators are not supported. You need to download all tasks using
as specific a WHERE clause as possible then Filter in your application.
Alternatively add formulae in custom fields then use them in your WHERE.
 
D

Dave

Rod

Thanks for your help. I must admit I was quite frustrated when I wrote my
post. I thought I was losing my mind. I thought the SQL support was through
the reference to ADO library and would be consistent with MS-Access. Thanks
again...

Rod Gill said:
If you read the prjoledb.htm file carefully you will see that the ANY, LIKE,
and IS NOT operators are not supported. You need to download all tasks using
as specific a WHERE clause as possible then Filter in your application.
Alternatively add formulae in custom fields then use them in your WHERE.

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more


Dave said:
I am trying to query MS-Project to pull Tasks with a specific
TaskOutlineCode3 value. So I set up a connection string as:

conData.ConnectionString =
"Provider=Microsoft.Project.OLEDB.10.0;PROJECT NAME=" & File_Name

I am able to open the connection and I have written several queries that
work as I expect. So far works great.

However, whenever I try to query the Tasks table with a WHERE condition
for
a field that is of type Text, it doesn't return any values. For Example

strSelect = "SELECT * FROM Tasks WHERE Taskname Like '*'
rstResources.Open strSelect, conData
Do While Not rstResources.EOF
Debug.Print rstResources![TaskID]
Loop

This returns 0 records, even though I have plenty of records with
Tasknames.
What am I doing wrong? Is this a bug? I am running MS-Project 2002

Any help would be greatly appreciated....
Dave
 

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