Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Help me for( Min & Max value )


Message #1 by "Arvind Pathak" <arvind_pathak@h...> on Wed, 24 Oct 2001 05:26:13 +0000
How I can gate Min & Max value in Visual Basic? here i am trying Min 

Function but not getting, if any other function please send example for me.



Awaiting your reply as soon as possible.



Thanks,

Arvind Pathak



Message #2 by "Preethi" <preethi@s...> on Wed, 24 Oct 2001 14:10:23 +0600
Create your own Functions:





Public Function Minimum(ByVal v1 As Variant, ByVal v2 As Variant) As Variant

Minimum = IIf(v1 > v2, v2, v1)

End Function



Public Function Maximum(ByVal v1 As Variant, ByVal v2 As Variant) As Variant

Maximum = IIf(v1 > v2, v1, v2)

End Function





If you want to get the mininum of 3 use d=minimum(a, minimum(b,c))



Preethi

----- Original Message -----

From: "Arvind Pathak" <arvind_pathak@h...>

To: "Access" <access@p...>

Sent: Wednesday, October 24, 2001 11:26 AM

Subject: [access] Help me for( Min & Max value )





> How I can gate Min & Max value in Visual Basic? here i am trying Min

> Function but not getting, if any other function please send example for

me.

>

> Awaiting your reply as soon as possible.

>

> Thanks,

> Arvind Pathak

>

>




>



Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 24 Oct 2001 07:18:55 -0700
One other way to go is to declare a ParamArray argument, and then loop

through the ParamArray keeping track of the lowest (or highest) value 'so

far'.  Once you get to the end, you should have the overall Min (or Max).

The advantage there is that you can pass any number of values as arguments.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

(xxx) xxx-xxxx



-----Original Message-----

From: Preethi [mailto:preethi@s...]

Sent: Wednesday, October 24, 2001 1:10 AM

To: Access

Subject: [access] Re: Help me for( Min & Max value )





Create your own Functions:





Public Function Minimum(ByVal v1 As Variant, ByVal v2 As Variant) As Variant

Minimum = IIf(v1 > v2, v2, v1)

End Function



Public Function Maximum(ByVal v1 As Variant, ByVal v2 As Variant) As Variant

Maximum = IIf(v1 > v2, v1, v2)

End Function





If you want to get the mininum of 3 use d=minimum(a, minimum(b,c))



Preethi

----- Original Message -----

From: "Arvind Pathak" <arvind_pathak@h...>

To: "Access" <access@p...>

Sent: Wednesday, October 24, 2001 11:26 AM

Subject: [access] Help me for( Min & Max value )





> How I can gate Min & Max value in Visual Basic? here i am trying Min

> Function but not getting, if any other function please send example for

me.

>

> Awaiting your reply as soon as possible.

>

> Thanks,

> Arvind Pathak
Message #4 by "Arvind Pathak" <arvind_pathak@h...> on Thu, 25 Oct 2001 04:43:06 +0000
Could you send me example for that.



thanks.

Arvind Pathak







>From: "Pardee, Roy E" <roy.e.pardee@l...>

>Reply-To: "Access" <access@p...>

>To: "Access" <access@p...>

>Subject: [access] Re: Help me  for( Min & Max value )

>Date: Wed, 24 Oct 2001 07:18:55 -0700

>

>One other way to go is to declare a ParamArray argument, and then loop

>through the ParamArray keeping track of the lowest (or highest) value 'so

>far'.  Once you get to the end, you should have the overall Min (or Max).

>The advantage there is that you can pass any number of values as arguments.

>

>HTH,

>

>-Roy

>

>Roy Pardee

>Programmer/Analyst

>SWFPAC Lockheed Martin IT

>(xxx) xxx-xxxx

>

>
Message #5 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 25 Oct 2001 07:19:08 -0700

Public Function FindMax(ParamArray varIn() As Variant) As Double

Dim varLoop As Variant

Dim dblReturn As Long



   dblReturn = CDbl(varIn(0))

   For Each varLoop In varIn

      If varLoop > dblReturn Then

         dblReturn = CDbl(varLoop)

      End If

   Next varLoop



FindMax = dblReturn



End Function





Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

Extension 8487



-----Original Message-----

From: Arvind Pathak [mailto:arvind_pathak@h...]

Sent: Wednesday, October 24, 2001 9:43 PM

To: Access

Subject: [access] Re: Help me for( Min & Max value )





Could you send me example for that.



thanks.

Arvind Pathak







>From: "Pardee, Roy E" <roy.e.pardee@l...>

>Reply-To: "Access" <access@p...>

>To: "Access" <access@p...>

>Subject: [access] Re: Help me  for( Min & Max value )

>Date: Wed, 24 Oct 2001 07:18:55 -0700

>

>One other way to go is to declare a ParamArray argument, and then loop

>through the ParamArray keeping track of the lowest (or highest) value 'so

>far'.  Once you get to the end, you should have the overall Min (or Max).

>The advantage there is that you can pass any number of values as arguments.

>

>HTH,

>

>-Roy

>

>Roy Pardee

>Programmer/Analyst

>SWFPAC Lockheed Martin IT

>(xxx) xxx-xxxx

>

>





  Return to Index