Link to home
Start Free TrialLog in
Avatar of YvetteYC
YvetteYC

asked on

how to get varPlant get description for plant code

I need to get the description name from varPlant which is set as a variant

varPlant(1,0) as Variant
varPlant = description
This is what I have which is not correct.  It may be easy to someone who knows VB but I'm new to this.
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Actually, you have it set as a variant array, which means you need to refer to the array dimensions in your second line.  Arrays don't have a 'default' like controls do.

varPlant(0,0) = description
or
varPlant(1,0) = description

Hope this helps.
-Jim
Avatar of YvetteYC
YvetteYC

ASKER

Okay now I'm getting a variable not defined (it's pointing at the description)  I shouldn't have this as a variable if I'm trying to get the plant description.  Or am I making this more difficult?
You need to to what jimhorn said then, you need to define the variable description, and put something in it. Alternatively just put a literal straight into the variable.

Something like
...
    Dim description As String
...  

 description = "My description"
...
    varPlant(0,0) = description
    'or
    'varPlant(1,0) = description

OR

    varPlant(0,0) = "My description"
    or
    varPlant(1,0) = "My description"

ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much cleared up a lot. Thanks