PDA

View Full Version : Variable Custom Field Formula



zimscho
02-10-2010, 03:19 AM
Please ignore the below Post,

By creating a custom form I am able to set and adjust the values in another custom field and then referenced this field in the required field formula.
Works perfectly :rotlaugh:and no macro required.

Cheers

Hi All,

If possible could someone please assist me in correcting the inserted code.
I am trying to adjust the formula in a custom field based on a user input box.
The formula is wrapped so it is not seeing the user input (InputVal).:dunno


Sub Change_Formula()
Dim InputVal As Boolean

InputVal = InputBox("Enter Cost Price")


SelectTaskColumn Column:="Number1"
TableEdit Name:="Cost", TaskTable:=True, NewName:="", FieldName:="", NewFieldName:="Text5", Title:="", Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, ColumnPosition:=8, AlignTitle:=1
TableApply Name:="Cost"
SelectTaskColumn Column:="Text5"
TableEdit Name:="Cost", TaskTable:=True, NewName:="", FieldName:="Text5", NewFieldName:="Text5", Title:="Cost", Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, ColumnPosition:=8, AlignTitle:=1
TableApply Name:="Cost"
SelectTaskColumn Column:="Text5"
CustomFieldSetFormula FieldID:=pjCustomTaskText5, Formula:="CCur([Number1]*[InputVal])*100" 'Formula:="CCur([Number1]*1458)*100"
CustomFieldPropertiesEx FieldID:=pjCustomTaskText5, Attribute:=pjFieldAttributeFormula, SummaryCalc:=pjCalcNone, GraphicalIndicators:=False, AutomaticallyRolldownToAssn:=False
ColumnDelete
End Sub
Any :help is appreciated.

Regards

Adam