Consulting

Results 1 to 1 of 1

Thread: Variable Custom Field Formula

  1. #1
    VBAX Newbie
    Joined
    Feb 2010
    Posts
    1
    Location

    Lightbulb Variable Custom Field Formula

    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 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).

    HTML Code:
    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 is appreciated.

    Regards

    Adam
    Last edited by zimscho; 02-10-2010 at 06:04 AM. Reason: Solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •