none
Unique values in custom field RRS feed

  • Question

  • Hello,

    We are working on Project Server 2010. The client requires the following:

    While creating new projects in MS Project Professional 2010 there should be field (Project level) which will contain unique value and the user should be able to enter it.

    They will call it Project ID and would like to enter by themselves in numbers like 1, 2, 3 etc.

    Is there a way where we can achieve this using the custom field?

    Thank you and

    Regards

    Tanzim Akhtar


    Tanzim Akhtar

    Saturday, April 28, 2012 7:52 AM

Answers

All replies

  • Yes Possible use VBA macro to validate the custom field value against reporting Db for checking the uniqueness of value and display message accordingly
    and prevent save if duplicate, for project events and their

    for VBA programming ready reference refer to : http://msdn.microsoft.com/en-us/library/ms448515.aspx

    Some samples available : http://masamiki.com/project/macros.htm

    let us know if this helps


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Saturday, April 28, 2012 9:48 AM
    Moderator
  • Thank you very much Sunil.

    This can also be achieved by EventHandler isn't it? Please let me know if I am wrong.

    Can we have something without programming?


    Tanzim Akhtar

    Saturday, April 28, 2012 10:20 AM
  • Yes can be achieved via event handler as well, but not without programming, however i recommended using VBA was since you mentioned user is going to enter the value within MSP

    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Saturday, April 28, 2012 10:32 AM
    Moderator
  • I am not able to find how to connect to the reporting Db through VBA.

    Can you provide me help in this please?


    Tanzim Akhtar

    Tuesday, May 1, 2012 12:27 PM
  • I am not able to find how to connect to the reporting Db through VBA.

    Can you provide me help in this please?


    Tanzim Akhtar

    Hello Tanzim

    Check this post, it has a macro connecting to reporting DB and using it

    http://epmxperts.wordpress.com/2011/02/21/open-multiple-project-files-from-within-ms-project-and-do-operation/


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    • Marked as answer by Tanzim Wednesday, May 2, 2012 11:46 AM
    Tuesday, May 1, 2012 6:59 PM
    Moderator
  • For knowledge purpose I would like to post the code here ...

    Add Reference to Microsoft ActiveX Data Objects 6.0 Library

    Sub LoopingProjectNames()

    Dim Conn As ADODB.Connection
    Dim Recs As ADODB.Recordset

    'Connect to Project Server Reporting DB
    Set Conn = New ADODB.Connection
    Conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PS_80_Reporting;Data Source=EPM2010"
    Conn.Open

    'Check whether connected or not
    If Conn.State = adStateOpen Then
        MsgBox "Connected :)"
    Else
        MsgBox "Not Connected :("
    End If

    'Get Project Names
    Set Recs = Conn.Execute("Select ProjectName From MSP_EpmProject_UserView")

    If Not Recs.EOF Then
        Do While Not Recs.EOF
            MsgBox Recs(0)
            Recs.MoveNext
        Loop
    End If

        Recs.Close
        Conn.Close
        Set Recs = Nothing
        Set Conn = Nothing
    End Sub


    Tanzim Akhtar

    Saturday, May 5, 2012 11:49 AM