Importing data from an Access query into Project

E

Edge30

Hello,
I searched but couldn't find any posts about this matter, I apologize if
this has been treated before.
MS project 2002, MS Access 2003.

I have an access database which is the central component of my work.
I have a project which needs to use some data existing in the db above
I have a VBA macro which executes an 'import' of the data, process it and
bla bla bla...
My problem is that the 'import' feature of Project can only connect to
Access TABLES
In my Access db I gather the data needed using a QUERY. I don't want to have
all in a table because I't be a huge one

So I'd like to know:

1) is there a way to 'import' directly an access query into project?

or

2) I can use VBA to dynamically connect to access -> run a macro that will
store the query results on a temporary table -> import the temporary
table -> delete the temporary table

But for 2, I'd need some guidance as I've never connected to access from
project before (I've connected project to excel though)...

So if anybody can help me with a few lines of code, I can figure out the
rest but I need to know the basics...

This is more or less how I'd do it if it were project+excel, I need to know
what to change for access?

Dim oACC As Object
Dim sFullPath As String

Set oACC = CreateObject("?????????????")
oACC.UserControl = True
sFullPath = "D:\Projects\All\Admin.mdb"
With oACC
.Visible = False
.Open (sFullPath)
.Run "MyAccessMacro that will create the table"
Activeproject.FileOpen.... (this part imports the temporary table
::I already have it)
.????? (delete the remporary table)
.Close
.Quit
end with
 
R

Rod Gill

Hi,

For VBA questions, please use the project.developer news group in future.
However, to answer your question, I would connect using oledb and directly
read your data from your query. So, search www.msdn.microsoft.com for VBA
code to read oledb data from Access. You can read directly from a View, no
need for a temporary table. Tables are for when you use the import wizard.
Alternatively, my VBA book explains fully how to read and write data to and
from Access and SQL Server.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
L

Lisa

Access has a type of query called a "Make Table Query", that will output your
data into a temporary table.

You could use that to convert your query output into a table just for the
purposes of importing it into Project.
 

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