Results 1 to 4 of 4

Thread: [RESOLVED] ByRef type mismatch passing a variant array to a function

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Resolved [RESOLVED] ByRef type mismatch passing a variant array to a function

    Hi

    i cant figure out and i forgot how this happens.

    im getting a ByRef mismatch when im passing a variant/array to a function, the function fails when its called

    any ideas?

    Code:
    Data = GETProfile_ID(ID)                'This returns a variant/Array 2D 1 base
            EMails = GetEMails(Data) 'GetEmails recieves a variant (data)
    the error is highlighting a part of code that is trying to read the 'Data'
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,414

    Re: ByRef type mismatch passing a variant array to a function

    Show the Function-Headers?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: ByRef type mismatch passing a variant array to a function

    Code:
    AddEmail(Trim(test(i, 2)), lst)
    Code:
    Private Function AddEmail(eMail As String, lst As EMailList) As EMailList
    the error was occurring on the first part passing test(i, 2), i added the trim part which actually fixed the problem. but why is it not working without the trim part (which is returning a string, but so should the array!?)

    The test variable is a variant/string array
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: ByRef type mismatch passing a variant array to a function

    I am think this problem is something ive had before and it is all to do with passing incorrect types through arrays, variant string types im guessing are not string types internally (i am guessing) and some of the official content i see online is also saying things along these lines.

    so basically its a type mismatch if im not mistaken. the byref mismatch error is maybe a catch them all error mismatch.
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


Posting Permissions

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



Click Here to Expand Forum to Full Width