Link to home
Start Free TrialLog in
Avatar of rnemani
rnemani

asked on

How do I get the data in a custom field in MS PROJECT using MSACCESS VBA

Hi,
I have the code as shown. In my mpp file I have created a custom field which has data. How can I get the custom field data. Primarily, waht I am looking at is what would be the table name and field name which I could use in lieu of the following:

 rstTasksProj.Open "SELECT tasksname FROM  tasks ", cnnProj

Please help
Dim address, textVal As String
    Dim X As Integer
    address = dirText.Value & "/mpp/testConsol1.mpp"
    
    Dim cnnProj As New ADODB.Connection 'Ado connection to ms project
    Dim rstTasksProj As New ADODB.Recordset 'Project tasks table
    
    'address is simply the location of the MS Project file - could be 'C:/Test.mpp' but would need to be within the " "
    cnnProj.Open "Provider = Microsoft.Project.OLEDB.11.0; Project Name =" & address
    
    rstTasksProj.Open "SELECT tasksname FROM  tasks ", cnnProj
    
    
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim fld As ADODB.Field
    Set dbs = CurrentDb
       
    If Not rstTasksProj.EOF Then
    Do Until rstTasksProj.EOF
            dbs.Execute " INSERT INTO tmpTestName (text1) Values ('" & rstTasksProj.Fields(0).Value & "')"
           rstTasksProj.MoveNext
    Loop
    End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of defi0
defi0
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rnemani
rnemani

ASKER

I had to get a file from projet server so did not need the column