Kath Pelletti
kp at sdsonline.net
Mon Nov 5 18:45:25 CST 2007
exactly - the unlimited aspect is perfect.. ----- Original Message ----- From: "jwcolby" <jwcolby at colbyconsulting.com> To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Sent: Monday, November 05, 2007 11:38 AM Subject: Re: [AccessD] highest value of 4 variables - urgent > The nice thing about the param array in this case is that you can pass in > as > many values as you wish to the function. In addition you can use the for > next iterator to step through the array. Those two concepts allow a very > quick and easy solution to this kind of problem, and additionally create a > generic solution that fits not only your specific need but any set of > numbers. > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti > Sent: Monday, November 05, 2007 6:13 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] highest value of 4 variables - urgent > > thanks Gustav - I have never really mastered arrays in vba (used to use > them > a lot in Cobol, RPG - but many moons ago). > > So thanks to you and John for the examples. > > Kath > ----- Original Message ----- > From: "Gustav Brock" <gustav at cactus.dk> > To: <accessd at databaseadvisors.com> > Sent: Monday, November 05, 2007 9:54 AM > Subject: Re: [AccessD] highest value of 4 variables - urgent > > >> Hi Kath >> >> I'm with JC. This is an excellent example to demonstrate the power of >> ParamArray. Here's an example specific for dates that I have used: >> >> Public Function DateMax(ParamArray avarDates() As Variant) As Date >> >> ' Return maximum date/time value of elements in >> ' array avarDates(). >> ' If no elements of array avarDates() are dates, >> ' value of cdatEmpty is returned. >> ' >> ' 2003-09-30. Cactus Data ApS, CPH. >> >> ' Return value for an empty array. >> Const cdatEmpty As Date = #1/1/100# >> >> Dim varDate As Variant >> Dim varDateMax As Variant >> >> For Each varDate In avarDates() >> If IsDate(varDate) Then >> If VarType(varDate) <> vbDate Then >> varDate = CDate(varDate) >> End If >> If varDate > varDateMax Then >> varDateMax = varDate >> End If >> End If >> Next >> >> If IsEmpty(varDateMax) Then >> varDateMax = cdatEmpty >> End If >> >> DateMax = varDateMax >> >> End Function >> >> /gustav >> >> >>>>> kp at sdsonline.net 03-11-07 23:57 >>> >> 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 >> > > > -- > 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 >