Home › Forums › Discussion › Running Queries based on a user inpu › Reply To: Running Queries based on a user inpu
Ben,
I don’t think you can make a custom field formula dependent on user input. From what you’ve written, each task has a number assigned either manually or with a formula, say in the Number1 custom field. You would like to automatically flag (using Flag1) only those tasks whose assigned number matches some selected criterion.
This is easiest to do using vba. For example, the following procedure opens an input box and asks which value (in the Number1) field you would like to flag. Then it sets Flag1 to “Yes” for all tasks whose Number1 matches the selection (“No” for all others.)
Sub ConditionalFlag()
Dim t As Task
Dim k As Long
k = InputBox("Enter Number to Flag")
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.Number1 = k Then
t.Flag1 = "Yes"
Else
t.Flag1 = "No"
End If
End If
Next t
End Sub