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

Posted on 2009-05-01
Last Modified: 2013-11-15
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 & "')"



    End If

Open in new window

Question by:rnemani
    LVL 5

    Accepted Solution

    If you created a custom field, you must have used one of Project's existing fields such as Text1...30 or Number1...20 and renamed it to whatever you wanted to call it.
    Project's ADODB provider does not take the new names into account. You therefore need to query the TaskText1...30 or TaskNumber1...20 columns instead (using the number corresponding to the field you retained for your custom data). E.g.  select TaskText1 from tasks;

    Author Closing Comment

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

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now