[AccessD] [EXTERNAL] Re: Parameter (argument) order
Rocky Smolin
rockysmolin2 at gmail.com
Fri Feb 17 10:52:20 CST 2023
There's no date on the entry. Perhaps it was written for an earlier
version of Access for which it was a restriction?
Rocky
On Fri, Feb 17, 2023 at 8:24 AM jack drawbridge <jackandpat.d at gmail.com>
wrote:
> Shane,
>
> I totally agree with you that it isn't and shouldn't be considered 100%
> trustworthy. What I find impressive is that it gets you deeper into the
> ballpark than Google or Bing alone. As with any software there is always a
> hidden proviso --beware; due diligence is user/reader responsibility; some
> assumptions have been made;
> You know the old -made in a nut free facility but (may contain peanuts)
>
> On Fri, Feb 17, 2023 at 11:13 AM Shane Groff via AccessD <
> accessd at databaseadvisors.com> wrote:
>
> >
> > Yes, it is impressive. However, you need to use your own judgment, it
> > cannot always be trusted.
> >
> > For example, this is not true, "Note that when passing arrays to a
> > function, you need to make sure that the arrays are of the same data type
> > and have the same number of elements."
> >
> > Shane
> >
> > ________________________________
> > From: AccessD <accessd-bounces+shaneg=microsoft.com at databaseadvisors.com
> > <mailto:accessd-bounces+shaneg=microsoft.com at databaseadvisors.com>> on
> > behalf of jack drawbridge <jackandpat.d at gmail.com<mailto:
> > jackandpat.d at gmail.com>>
> > Sent: Friday, February 17, 2023, 7:12 AM
> > To: Access Developers discussion and problem solving <
> > accessd at databaseadvisors.com<mailto:accessd at databaseadvisors.com>>
> > Subject: Re: [AccessD] [EXTERNAL] Re: Parameter (argument) order
> >
> >
> > Yes John, quite impressive.
> >
> >
> > On Fri, Feb 17, 2023 at 9:51 AM John Colby <jwcolby at gmail.com<mailto:
> > jwcolby at gmail.com>> wrote:
> >
> > > LOL, how cool is that.
> > >
> > > On Fri, Feb 17, 2023 at 8:46 AM jack drawbridge <
> jackandpat.d at gmail.com
> > <mailto:jackandpat.d at gmail.com>>
> > > wrote:
> > >
> > > > Arthur,
> > > > I submitted your question to chatgpt and received a response as
> > follows.
> > > >
> > > ------------------------------------------------------------------
> > > > Ms access how to pass 2 arrays to a function that compares the arrays
> > > > element by element and returns false if they are not equivalent?
> > > >
> > > > To pass two arrays to a function in MS Access VBA and compare them
> > > element
> > > > by element, you can follow these steps:
> > > >
> > > > Declare a function that accepts two arrays as arguments. For
> > example:
> > > >
> > > > vbnet
> > > >
> > > > Function CompareArrays(arr1() As Variant, arr2() As Variant) As
> Boolean
> > > > ' Your code here
> > > > End Function
> > > >
> > > > In this example, we're declaring a function called CompareArrays that
> > > > accepts two arrays of Variant type as arguments.
> > > >
> > > > In the function body, loop through the elements of the arrays and
> > > > compare them element by element. If any of the elements are not
> equal,
> > > > return False. If all of the elements are equal, return True. For
> > example:
> > > >
> > > > vbnet
> > > >
> > > > Function CompareArrays(arr1() As Variant, arr2() As Variant) As
> Boolean
> > > > Dim i As Integer
> > > >
> > > > If UBound(arr1) <> UBound(arr2) Then
> > > > CompareArrays = False
> > > > Exit Function
> > > > End If
> > > >
> > > > For i = 0 To UBound(arr1)
> > > > If arr1(i) <> arr2(i) Then
> > > > CompareArrays = False
> > > > Exit Function
> > > > End If
> > > > Next i
> > > >
> > > > CompareArrays = True
> > > > End Function
> > > >
> > > > In this example, we're first checking if the length of the two arrays
> > is
> > > > equal. If they are not, we return False. Then, we loop through the
> > > elements
> > > > of the arrays using the For loop and compare them element by element.
> > If
> > > > any of the elements are not equal, we return False. If all of the
> > > elements
> > > > are equal, we return True.
> > > >
> > > > To call the function, create two arrays and pass them to the
> > function
> > > > as arguments. For example:
> > > >
> > > > scss
> > > >
> > > > Dim arr1(2) As Variant
> > > > Dim arr2(2) As Variant
> > > >
> > > > arr1(0) = 1
> > > > arr1(1) = 2
> > > > arr1(2) = 3
> > > >
> > > > arr2(0) = 1
> > > > arr2(1) = 2
> > > > arr2(2) = 4
> > > >
> > > > Debug.Print CompareArrays(arr1, arr2) ' Returns False
> > > >
> > > > In this example, we're creating two arrays arr1 and arr2, filling
> them
> > > with
> > > > elements and passing them to the CompareArrays function. The function
> > > > returns False because the last element of arr1 and arr2 are
> different.
> > > >
> > > > Note that when passing arrays to a function, you need to make sure
> that
> > > the
> > > > arrays are of the same data type and have the same number of
> elements.
> > > >
> >
> >
> > --
> > 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