Verifying with VBA that a Project Exists when stored in ODBC db 
Author Message
 Verifying with VBA that a Project Exists when stored in ODBC db

To all,

THE QUESTION:
How to I verify in VBA from Access97 that a Project2000 project exists
when I'm accessing the project through ODBC?

WHAT I'VE TRIED:
1.  Dir() - Doesn't work on ODBC, only on normal directories.  But
hey, I could hope.

2. Trapping the error from the fileopen -
For whatever reason, I'm still getting the popup 1004 error stating
the file cannot be opened.  On error doesn't seem to work here.  My
error routine was doing the create the new project part if I could get
execution to route there.

WHY AM I DOING THIS:
I'm writing a macro that will create a specialized project from a
template plan.  Both are stored on our project central SQL Server
database.

Basically, I'm trying to do the following:  if the target file exists,
do nothing, else copy the template and create the new one.  However,
if I can't verify the existence, I risk accidently overlaying an
existing plan.

Anybody got any ideas?

Thanks!
--TG



Wed, 25 Feb 2004 01:15:01 GMT  
 Verifying with VBA that a Project Exists when stored in ODBC db
Since your stuff is all in a database, how about:

select Project_Name from MSP_PROJECTS

then check the result set to see what projects exist.

You could link to the db table or whatever you want to open the connection.

--
Please try to keep replies in this group. I do check e-mail, but only
infrequently.

-Jack Dahlgren, Project MVP

+++++++++++++++++++

Quote:
> To all,

> THE QUESTION:
> How to I verify in VBA from Access97 that a Project2000 project exists
> when I'm accessing the project through ODBC?

> WHAT I'VE TRIED:
> 1.  Dir() - Doesn't work on ODBC, only on normal directories.  But
> hey, I could hope.

> 2. Trapping the error from the fileopen -
> For whatever reason, I'm still getting the popup 1004 error stating
> the file cannot be opened.  On error doesn't seem to work here.  My
> error routine was doing the create the new project part if I could get
> execution to route there.

> WHY AM I DOING THIS:
> I'm writing a macro that will create a specialized project from a
> template plan.  Both are stored on our project central SQL Server
> database.

> Basically, I'm trying to do the following:  if the target file exists,
> do nothing, else copy the template and create the new one.  However,
> if I can't verify the existence, I risk accidently overlaying an
> existing plan.

> Anybody got any ideas?

> Thanks!
> --TG



Wed, 25 Feb 2004 04:54:30 GMT  
 Verifying with VBA that a Project Exists when stored in ODBC db
TG,

I've done it the following way:

Sub SaveMPPFile(PjName)
'
'
' This function opens the project files - if they already exist.
' If they don't, the newly created file is saved with the respective name.
'
On Error GoTo DoesNotExist
    ' Open the mpp-file
    FileOpen Name:=PjName, ReadOnly:=False, FormatID:="MSProject.MPP"
    ' close it again
    FileClose (pjDoNotSave)
On Error GoTo 0

Exit Sub

DoesNotExist:
    FileSaveAs Name:=PjName, FormatID:="MSProject.MPP"
    FileClose (pjDoNotSave)

End Sub

As you can see, I check if the file exists, by trying to open it.  If
opening it fails - because it does not exist - I save the new file.
If it does exist, I close it again without saving it.

Werner


Quote:
> To all,

> THE QUESTION:
> How to I verify in VBA from Access97 that a Project2000 project exists
> when I'm accessing the project through ODBC?

> WHAT I'VE TRIED:
> 1.  Dir() - Doesn't work on ODBC, only on normal directories.  But
> hey, I could hope.

> 2. Trapping the error from the fileopen -
> For whatever reason, I'm still getting the popup 1004 error stating
> the file cannot be opened.  On error doesn't seem to work here.  My
> error routine was doing the create the new project part if I could get
> execution to route there.

> WHY AM I DOING THIS:
> I'm writing a macro that will create a specialized project from a
> template plan.  Both are stored on our project central SQL Server
> database.

> Basically, I'm trying to do the following:  if the target file exists,
> do nothing, else copy the template and create the new one.  However,
> if I can't verify the existence, I risk accidently overlaying an
> existing plan.

> Anybody got any ideas?

> Thanks!
> --TG



Fri, 27 Feb 2004 22:24:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to add a dataset in an existing db by using vba from excel

2. Calling stored PL/SQL package in Oracle DB using ODBC

3. WANTED: Consultant on ODBC/VBA/DAO project

4. automating export data from project to oracle db using vba

5. String connection to DB project in VBA

6. Execute parameterized query stored in ACCESS-2 DB thru VBA

7. VBA - MS Project and ODBC Access

8. WANTED: Consultant on ODBC/VBA/DAO project

9. WANTED: Consultant on ODBC/VBA/DAO project

10. Import existing projects into Project Server

11. Verifying If Object Exists

12. Verify existing of an assembly

 

 
Powered by phpBB® Forum Software