Kath Pelletti
kp at sdsonline.net
Sat Nov 3 19:13:52 CDT 2007
good one michael - how could i have forgotten ??? :) i'll play with that and see if I can just get the highest rather than all values sort low-high. thanks ----- Original Message ----- From: "Michael R Mattys" <mmattys at rochester.rr.com> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Sunday, November 04, 2007 10:57 AM Subject: Re: [AccessD] highest value of 4 variables - urgent > Remember this? (Just kidding, but it is from NeatCode.mdb) > > Sub ShellSortArray(A() As Variant) > Dim i As Long, j As Long > Dim Low As Long, Hi As Long > Dim PushPop As Variant > Low = LBound(A) > Hi = UBound(A) > j = (Hi - Low + 1) \ 2 > Do While j > 0 > For i = Low To Hi - j > If A(i) > A(i + j) Then > PushPop = A(i) > A(i) = A(i + j) > A(i + j) = PushPop > End If > Next i > For i = Hi - j To Low Step -1 > If A(i) > A(i + j) Then > PushPop = A(i) > A(i) = A(i + j) > A(i + j) = PushPop > End If > Next i > j = j \ 2 > Loop > End Sub > > Function TestShellSortArray() > Dim vA() As Variant > Dim i As Long > vA = Array(64, 16, 8, 32, 40, 48, 24, 56) > ShellSortArray vA() > For i = LBound(vA()) To UBound(vA()) > Debug.Print vA(i) > Next > End Function > > Michael R. Mattys > MapPoint & Access Dev > www.mattysconsulting.com > > ----- Original Message ----- > From: "Kath Pelletti" <kp at sdsonline.net> > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > Sent: Saturday, November 03, 2007 7:35 PM > Subject: Re: [AccessD] highest value of 4 variables - urgent > > >> That's where I am with it too Rocky - until I get another solution I will >> go >> with this.....(but I'm sure there will be something that we both can't >> remember?) >> >> Ta >> ----- Original Message ----- >> From: "Rocky Smolin at Beach Access Software" <rockysmolin at bchacc.com> >> To: "'Access Developers discussion and problem solving'" >> <accessd at databaseadvisors.com> >> Sent: Sunday, November 04, 2007 10:29 AM >> Subject: Re: [AccessD] highest value of 4 variables - urgent >> >> >>> Brute Force? >>> >>> Function GetHigh as Variant >>> >>> GetHigh = var1 >>> If var2 > GetHigh Then GetHigh = var2 >>> If var3 > GetHigh Then GetHigh = var3 >>> If var4 > GetHigh Then GetHigh = var4 >>> >>> End Function >>> >>> I'm sure there's a more elegant way... >>> >>> Rocky >>> >>> >>> >>> >>> >>> -----Original Message----- >>> From: accessd-bounces at databaseadvisors.com >>> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti >>> Sent: Saturday, November 03, 2007 3:57 PM >>> To: Access D Normal List >>> Subject: [AccessD] highest value of 4 variables - urgent >>> >>> maybe i am having a vague moment - but what function can I use to get >>> the >>> highest value of 4 variables, eg: >>> >>> >>> eg. I want to know x where x is the highest of (var1, var2, var3, var4) >>> >>> ta >>> ______________________________________ >>> Kath Pelletti >>> -- >>> AccessD mailing list >>> AccessD at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/accessd >>> Website: http://www.databaseadvisors.com >>> >>> No virus found in this incoming message. >>> Checked by AVG Free Edition. >>> Version: 7.5.503 / Virus Database: 269.15.19/1106 - Release Date: >>> 11/2/2007 >>> 9:46 PM >>> >>> >>> -- >>> AccessD mailing list >>> AccessD at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/accessd >>> Website: http://www.databaseadvisors.com >>> >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >