Project SummaryInfo overwritten when FileOpen executes.

P

Phred Bear

These two problems are probably simple enough but are eluding me. Can
anybody help me to resolve them.



Problem One:



I create a new project and populate it from an Access DB. I set the Project
Start Date as the earliest date in the DataSet. This works OK until it gets
to the line



..FileOpen Name:=dbName, ReadOnly:=False, Merge:=0, map:="Map 6"



which implements the MapEdit params.



At that point, the Project Start Date is overwritten with the current days
date.

This throws an error message in project saying the task date is earlier than
the project start date.



Here is an abstract of the code which doesn't do the business. Any ideas?





Set pj = CreateObject("MSProject.Application")

pj.FileNew (False)

StartDate = ExtractMinDate '(Function to extract earliest date from
Access Data)



ProjectSummaryInfo Start:=StartDate



With pj

.Visible = True



..MapEdit Name:="Map 6", Create:=True, OverwriteExisting:=True,
DataCategory:=0, CategoryEnabled:=True, TableName:="BarChart",
FieldName:="ID", ExternalFieldName:="ID", ExportFilter:="All Tasks",
ImportMethod:=pjImportAppend, HeaderRow:=True, AssignmentData:=False,
TextDelimiter:=Chr$(9)



.MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Name",
ExternalFieldName:="Ref No"



..MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Actual Start",
ExternalFieldName:="Date ToR Agreed"



..MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Actual Finish",
ExternalFieldName:="EstimatedEndDate"



..FileOpen Name:=dbName, ReadOnly:=False, Merge:=0, map:="Map 6"



More code.. (Which works OK)



Second Problem, more an irritant really.



I can only run this method once per session of Access. I have to close
Access and re-start it again to run my method again. I will figure out why
later, something to do with the server not running in Win XP. Because of
this, I keep hopping in and out of the VBA Environment where I have umpteen
modules. When Access VBA opens, the default module showing is the same one
each time but not the one I want. It is just a random module of no special
significance. I have to select the one I am working on before I can do a
quick fix to the code. The question is: How do I select the Module which I
want to be the default when I open Access. I have tried saving with only
that module visible and similar attempts but to no avail.



Thanks.



Ian Millward

Edinburgh
 

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