Re: Possible Project Bug: All Projects in Database are Deleted upon Save

From: Rod Gill (rodsngtrap_at_hotmail.com)
Date: 08/30/04


Date: Mon, 30 Aug 2004 19:30:48 +1200

Hi,

In Access when I run the following Code (with reference to Project 2003
object library selected It runs OK. Without the displayalerts Project
prompts with Append or overwrite message. Thankfully in Project 2003 at
least the default is append.

Sub test()
Dim ProjApp As MSProject.Application
    On Error Resume Next
    Set ProjApp = GetObject(, "MSProject.Application")
    If ProjApp Is Nothing Then
        Set ProjApp = CreateObject("MSProject.Application")
        ProjApp.Visible = True
    End If
    With ProjApp
        FileNew Template:=""
        FileSaveAs Name:="<D:\@ProjectSystems\Temp\Project.mpd>\Project1",
FormatID:="MSProject.MPD"
        FileNew Template:=""
        .DisplayAlerts = False
        FileSaveAs Name:="<D:\@ProjectSystems\Temp\Project.mpd>\Project2",
FormatID:="MSProject.MPD"
        .DisplayAlerts = True
    End With
    Set ProjApp=Nothing
End Sub

-- 
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
"Ross Herbert" <ross_herbert@hotmail.com> wrote in message
news:eZWkwRjjEHA.1356@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> This is a re-post, so I apologise for anyone who cares about such things.
> Except, I don't yet have an answer that resolves the problem, and on three
> disparate computers with a lot of testing I get exactly the same problem.
>
> First: the problem didn't happen with Project 2000 - it is only happening
> with Project 2002 (Professional edition to be specific).  Project 2002 is
> required in my case as it is the new corporate standard.
>
> Second: The same VBA code (with appropriate modifications for Automation)
> which works in MS Project DOES NOT WORK via Access VBA.
>
> Third: It appears to be a rather dangerous fault in MS Project, as for all
I
> can tell with my testing, anyone who tries to save to a .mpd or .mdb
> database will unintentionally DELETE all their stored projects except for
> the project being saved.  There is no message, no error, just a complete
> DELETION of the current database.
>
> The code I am using is the rather innocuous:
> filesaveas name:="<mydatabase.mpd>\project1", formatid:="MSProject.mpd"
>
> This code, rather than append the project to the database, will actually
> delete the Database and create a new one with only the specified project
> saved in it.  I understand that there is an option with the DisplayAlerts
> codeword to not show messages when saving and therefore append by default
if
> DisplayAlerts=false.  However, DisplayAlerts doesn't appear to have any
> affect when used from Access.  In Project it correctly will allow
APPENDING
> of the Project to the Database.  Via Access it does nothing of this kind
and
> Project always OVERWRITES THE ENTIRE DATABASE.
>
> Now, I am not exactly stupid, and I have used a lot of VBA variations,
> recorded macros in Project, copied them over to Access with modification
so
> they will work, created them from scratch, scoured the help file and the
> internet, tried different Access versions, Windows OS',  etc.  The point
is,
> a fairly simple and normal command (Save) completely destroys data and
> having searched the internet for answers I only find blank stares.  On the
> occasions others have found the same bug the responses have been a shrug
of
> shoulders.  I may get the same response on this occasion too, however, if
> anyone knows anything can they please respond with their answer or
> workaround.
>
> If no one knows anything perhaps a kind MVP could inform Microsoft.
>
> Thankyou, and Regards,  Ross
>
>


Relevant Pages

  • Re: Possible Project Bug: All Projects in Database are Deleted upon Save
    ... best practices and Project VBA ... > Only Project1 is saved into the database. ... >> prompts with Append or overwrite message. ... >> For Microsoft Project companion projects, ...
    (microsoft.public.project.vba)
  • Re: I need a Macro
    ... Sorry - you'll need to save your macro as MACRO_EXPORT, then in the vba ... Create an APPEND QUERY in Access. ... database. ...
    (microsoft.public.excel.programming)
  • Possible Project Bug: All Projects in Database are Deleted upon Save
    ... The same VBA code ... DELETION of the current database. ... This code, rather than append the project to the database, will actually ... occasions others have found the same bug the responses have been a shrug of ...
    (microsoft.public.project.vba)
  • Re: Possible Project Bug: All Projects in Database are Deleted upon Save
    ... Only Project1 is saved into the database. ... Considering 2002 is not very old Microsoft ... > prompts with Append or overwrite message. ... > For Microsoft Project companion projects, best practices and Project VBA ...
    (microsoft.public.project.vba)
  • Re: Parameter dialog box pops up
    ... > I need to update my Access database from an Excel list. ... The question is how do I append each field from ... > append query for each table from my TableN and run them separately). ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.tablesdbdesign)