none
Run-Time error '1004': The field “Active” Does Not Exist RRS feed

  • Question

  • I'm receiving this error on a user's PC. They are using Project 2013 on Windows 7. On our own test machines with Project 2013 on Windows 10 and Project 2016 on Windows 10), we are not seeing the same error.

    The error's getting thrown all over the place, but one example is FilterEdit found here here:

    Sub STAT_Leads_Preds()
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
        If Not pActive Then
            FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
        Else
        End If
    End Sub

    It's unclear why this message appears. "Active" is, in fact, a field. And, like I said, we are not seeing this issue on test machines.

    For reference, here's what the error looks like:

    EDIT: To clarify, the FilterEdit throwing the error is the last:

    FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False


    • Edited by user905 Thursday, December 12, 2019 1:48 PM
    Wednesday, December 11, 2019 9:03 PM

Answers

  • Looks like Project Standard does not have the "Active" field. Our solution involved checking for the edition of the software using Application.Edition, which can be one of two values: pjEditionProfessional or pjEditionStandard.

    Here's how the code ended up looking:

    Sub STAT_Leads_Preds()
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
        If Not pActive And Application.Edition = pjEditionProfessional Then
            FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
        Else
        End If
    End Sub
    • Marked as answer by user905 Saturday, December 14, 2019 12:27 AM
    Saturday, December 14, 2019 12:27 AM

All replies

  • user905,

    What is "pActive"? The variable "pActive" is undefined (i.e. empty) so the If statement will always be true. Maybe that's why it's flagging an error.

    As far as your reference screen shot, it doesn't help. It shows the error but doesn't show what code line is highlighted.

    There must be more to this than you are showing.

    John



    Thursday, December 12, 2019 1:54 AM
  • As I recall, Project Standard specifically prohibits user reading or writing of the Active field, and any code references to the field will throw an exception.  You may need to implement an error handler to bypass it.

    Is your problem user on Project Standard?

    Good luck, tom

    Thursday, December 12, 2019 3:06 AM
  • user905,

    What is "pActive"? The variable "pActive" is undefined (i.e. empty) so the If statement will always be true. Maybe that's why it's flagging an error.

    As far as your reference screen shot, it doesn't help. It shows the error but doesn't show what code line is highlighted.

    There must be more to this than you are showing.

    John



    John, see my edits. The FilterEdit throwing the error is the last one, which is what the reference screenshot ties to. The first two succeed.
    Thursday, December 12, 2019 1:50 PM
  • As I recall, Project Standard specifically prohibits user reading or writing of the Active field, and any code references to the field will throw an exception.  You may need to implement an error handler to bypass it.

    Is your problem user on Project Standard?

    Good luck, tom

    Tom, I believe you're onto something. Following your lead, I've found two references to this field being unavailable in Standard.

    My team and I are going to investigate this route as it's the most promising so far. Thanks a bunch. I'll make sure to report back if this resolves it.

    Thursday, December 12, 2019 2:24 PM
  • Looks like Project Standard does not have the "Active" field. Our solution involved checking for the edition of the software using Application.Edition, which can be one of two values: pjEditionProfessional or pjEditionStandard.

    Here's how the code ended up looking:

    Sub STAT_Leads_Preds()
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
        FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
        If Not pActive And Application.Edition = pjEditionProfessional Then
            FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
        Else
        End If
    End Sub
    • Marked as answer by user905 Saturday, December 14, 2019 12:27 AM
    Saturday, December 14, 2019 12:27 AM
  • user905,

    Glad you got it sorted.  As a minor clarification, Project Standard still has the "Active" field, and it is used in the scheduling calculations for versions after 2010.  For marketing reasons, user (and user-code) access to the field is blocked in the Standard Edition.

    tom

    Saturday, December 14, 2019 1:05 PM