Re: Type Mismatch Error in Array

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



OutOfNetwork needs to be declared as a variant, so:
Dim OutOfNetwork As Variant
or just
Dim OutOfNetwork

You then have an 0-based variant array and you can use that like this:
For i = 0 To UBound(OutOfNetwork)
Msgbox OutOfNetwork(i)
Next i
etc.

RBS


"JacyErdelt" <JacyErdelt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:C8C7B63E-3665-4465-892C-2DCD89A3ED49@xxxxxxxxxxxxxxxx
Can someone tell me why I might be getting the "type mismatch" error when I
get to the second line? These numbers must be strings because they are a
"label" for a store (like a store name), and the number that is entered by
the user and is compared to these numbers later in this code is confirmed as
a string in the other piece of code. Ideally, when a store number is entered
by the user, VBA should determine if the store entered is out of the network
based on its label (which is one of these 3 stores).

Dim OutOfNetwork As String
OutOfNetwork = Array("182", "244", "1457")

I can get the correct result if I run thru a bunch of nested if or case
statments, but I was hoping to keep the code short by having it only compare
its value to the store in this array. Thank you for your insight!

.



Relevant Pages

  • RE: IAzClientContext AccessCheck returns 0x80070057
    ... I get a successful access check. ... Could you post a text representation of your XML store? ... > VARIANT varOperationIdArray; ...
    (microsoft.public.platformsdk.security)
  • Re: Invalid use of Null error question
    ... string variable if nothing's been selected: string variables cannot be set ... only store numbers (Byte, Integer and Long can only store integer values, ... Variant is another type of variable. ... Dim strsql As String ...
    (microsoft.public.access.formscoding)
  • Re: Advice on storage and retrieval
    ... I guess in that interface i was already thinking about implemening using ... ...don't I need Item (as variant) to store and return the actual "thing" ... ..Item as String ...
    (microsoft.public.vb.general.discussion)
  • RE: Using StdRegProv::SetDWORDValue in C++
    ... IWbemClassObject* pInParamsDefinition = NULL; ... VARIANT varCommand; ... // Store the value for the in parameters ... NULL, pClassInstance, &pOutParams, NULL); ...
    (microsoft.public.win32.programmer.wmi)