How do I use a parameter as a Variable Name?

56 Views Asked by At

trying to make a sub routine that can varable parameters to find which varable to return.

    IF _FILEEXISTS("Std Motor Pricing.csv") THEN 
        OPEN "Std Motor Pricing.csv" FOR INPUT AS #3
        WHILE NOT EOF(3)
           INPUT #3, STR_HP$, STR_SPEED$, STR_ACC$, STR_FRAME$, STR_WEIGHT$, STR_BROOK_PREMIUM$, STR_BROOK_IEEE841$, STR_BROOK_CLASS1$, STR_WEG_PREMIUM$, STR_WEG_IEEE841$, STR_WEG_CLASS1$, STR_TECO_PREMIUM$, STR_TECO_IEEE841$, STR_TECO_CLASS1$, STR_TOSHIBA_PREMIUM$, STR_TOSHIBA_IEEE841$, STR_TOSHIBA_CLASS1$
           IF STR_HP$ <> "" OR STR_HP$ <> "Motor Size" THEN
              IF (mHP = VAL(STR_HP$) AND Pole% = 4 AND STR_SPEED$ = "1800") OR (mHP = VAL(STR_HP$) AND Pole% = 6 AND STR_SPEED$ = "1200") OR (mHP = VAL(STR_HP$) AND Pole% = 8 AND STR_SPEED$ = "900") THEN
                 IF VAL(STR_WEG_PREMIUM$) > 0 THEN
                    var1$ = "STR_WEG_PREMIUM$"
                    LPFoot = VAL(var1$)
                    print var1$, LPFoot
                    input "anykey", ok$
                 END IF
              END IF
           END IF
        WEND
        CLOSE #3
    END IF

I want to return LPFoot of the literal "STR_WEG_PREMIUM" with the variable STR_WEG_PREMIUM so I just have to create one sub routine instead of one for each different Variable that I want the value of.

I will call with GetStdMotorPricing("STR_WEG_PREMIUM",LPFoot) and have LPFoot have the price of STR_WEG_PREMIUM Motor.

1

There are 1 best solutions below

0
Patrick Coots On

dont know if this will help

    text$ = _TRIM$(STR$(base1))
    REDIM Numbers(LEN(text$))
    ' FOR i = 1 TO LEN(text$)
    y = LEN(text$)