[AccessD] [EXTERNAL] Re: Parameter (argument) order

Stuart McLachlan stuart at lexacorp.com.pg
Fri Feb 17 00:18:32 CST 2023


Oops, double pasted:

Function COmpareArrays() As Long
Dim a1(10) As String
Dim a2(10) As String
a1(2) = "Soome data"
a2(2) = a1(2)
Debug.Print ArrayCompare(a1(), a2())
End Function

Function ArrayCompare(ar1() As String, ar2() As String) As Boolean
'Return 0 for different, -1 for the same 
Dim i As Long 
If LBound(ar1()) <> LBound(ar2()) Then Exit Function 
If UBound(ar1()) <> UBound(ar2()) Then Exit Function 
For i = LBound(ar1()) To UBound(ar1())
  If ar1(i) <>  ar2(i) Then Exit Function
Next
ArrayCompare = True
End Function


On 17 Feb 2023 at 16:14, Stuart McLachlan wrote:

> 
> You could make the arrays variants instead of explicit strings or
> whatever for a more generic solution.
> 
> 
> 
> On 17 Feb 2023 at 1:00, Arthur Fuller wrote:
> 
> > Apparently I am failing to state my intention clearly. Let me try
> > once again.
> > 
> > Function arrCompare(a1, a2) as Boolean
> > 'the purpose of this function is to compare two arrays and return
> > true if they are equal, else false '.... your code goes here, but
> > essentially it walks both arrays element by element and exits on the
> > first detected difference 'first it might compare the lengths, in
> > which case a difference is an immediate exit reporting  False 'next
> > it might test the data types of the elements, and upon a difference
> > report False 'etc.
> > 
> > Show me how to pass two arrays into said function and return a true
> > or false. I would love to learn this! -- AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd Website:
> > http://www.databaseadvisors.com
> > 
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list