Re: How to pass a 2-D array into a function?



"Gman" <nah> wrote in message
news:%23hmLuRY6FHA.1148@xxxxxxxxxxxxxxxxxxxxxxx
> You can't have an array as an argument - you have to use a variant e.g.
>
> Function GetNewValue(strVal As String, mBcdeptID As Variant) As Boolean
> if isarray(mBcdeptID) then msgbox mBcdeptID(0)

Yes you can. I see code all the time passing arrays as variants and I have
no idea why. I don't think I've ever put an array into a variant in 10
years.

Michael


.



Relevant Pages

  • Re: Split Function Creates Error 13 Type Mismatch
    ... A Variant can hold a string and an array of string. ... Dim vAs Variant ... As it is, was Variant accept an array of string returned by Array, but not by Split. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Grouping shapes in Word
    ... The reason that it expects a Variant array as opposed to a String array is that ... a Variant can hold data of any type. ... Variant array of Shape names (string) or a Variant array of shape index numbers ... Dim avarShape() As Variant ...
    (microsoft.public.office.developer.vba)
  • Re: Sorting a variant array
    ... Dim tempList As Variant ... Dim testerList() As String ... Function sortTesters(rangeName As String) ... column range--but even that ends up as a x-rows by 1 column array. ...
    (microsoft.public.excel.programming)
  • Re: Populate listbox from array
    ... Static dbsAs String isn't required in your case: ... Static MyDeptArray As Variant ... > array. ... >> write a call-back function to populate your listbox. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Paasing an array in OpenArgs
    ... Although the OpenArgs property is a variant, the Access 2003 help file indicates it must contain a string expression. ... I thought a good way to do this would be to create an array with the two date values and pass the array in the openargs argument. ...
    (microsoft.public.access.formscoding)

Loading