none
How to priorize excution code for VB modules RRS feed

  • Question

  • Dear all,

    I've two VBA modules on MSP 2010:

    One is disabling the ability to "change a value" in a specific field

    The other is deleting the value for the same specific field.

    Do you know How to priorize excution code for VB modules ??

    In the delete situation, I'd like to disable (or bypass) temporary the "change value" lock.

    Any help will be appreciated

    Regards

    Wednesday, June 12, 2013 2:20 PM

Answers

  • Hi,

    I would the ClearBaseline code set a value for a public variable, and the notDelete event act only when that variable does not have that value.

    Greetings

    • Marked as answer by Arnaoud Thursday, June 27, 2013 1:48 PM
    Wednesday, June 12, 2013 7:48 PM
    Moderator

All replies

  • Arnaoud,

    Before we can help you with this we need more information. For example, how exactly are you "disabling the ability to change a field"? What is the field? What is the relationship between the two VBA modules? For example, are they user initiated or Even driven? If Even driven, how so? Are you in a Project Server environment?

    John

    Wednesday, June 12, 2013 3:04 PM
  • John,

    Let's move forward with the code:

    The first one is tracking the event ProjectBeforetaskChange with a test like this:

    If FieldConstantToFieldName(Field) Like "Baseline*" Then cancell = true

    The second is a call to the existing feature:: clear Baseline, on the event Projectbeforeclearbaseline

    The first one is blocking the second one for me that is fine but not for everyone...

    Arnaoud

    Wednesday, June 12, 2013 3:44 PM
  • Arnaoud,

    I haven't worked a lot with Event driven code but let's dig a little deeper. When you say, "the first one is blocking the second one for me that is fine but not for everyone...", what does that mean?

    Even if I can't help you directly, the information you provide will enable someone else to jump in with a suggestion.

    John

    Wednesday, June 12, 2013 4:40 PM
  • Hi,

    I would the ClearBaseline code set a value for a public variable, and the notDelete event act only when that variable does not have that value.

    Greetings

    • Marked as answer by Arnaoud Thursday, June 27, 2013 1:48 PM
    Wednesday, June 12, 2013 7:48 PM
    Moderator
  • John,

    If you lock  with code the edition of a field e.g the Baseline work, it means after you have set the Baseline that you can't edit the field manually.

    (Because the change of this field is not propagated in the various reports ,and it can be edited manually by Project managers)

    But if you are trying after to clear the Baseline (0 in the entire field) it won't work.

    As a result the first one is blocking the second one

    Wednesday, June 19, 2013 3:45 PM
  • Arnaoud,

    I still don't understand your "fine for me but not for everyone". I think that is because you are intimately familiar with your structure so it makes perfect sense to you but we are presented with your structure cold, so wrapping our minds around it is not simple.

    Did you try Jan's suggest about using a public variable?

    Project is not set up to allow lockout of editing like some other application may be. The whole file can be password protected, but locking individual parts of the file isn't easily achieved. Although you maybe able to come up with a scheme using Event driven code, as you are attempting to do, an easier approach is user training coupled with auditing performed on a regular basis. Make sure your users understand what they may and may not do and trust that they adhere to the rules. However, a good set of audit macros goes a long way in insuring everyone is following the rules. That worked for us.

    John

    Wednesday, June 19, 2013 4:28 PM
  • Hello John,

    Fine for me, because I like the idea that Baseline data is fixed in stone.

    Yes the public variable does the trick if the declaration is in a true module and not in a class module

    Thank you Jan

    Thursday, June 27, 2013 1:47 PM