MAX Function

  • Thread starter Thread starter an
  • Start date Start date
A

an

Hello!

In detail section I have Textboxes with numeric values
through NZ function.
I need, in another textbox, look the max value of the
refered textboxes but I don't know how.
I need help, please.
Thanks in advance.
an
 
Hi,

It sounds like you need to use a nested IIF function. Example:

=IIF([text1]<[text2],IIF([text2]<[text3],IIF([text3]<[text4],[text4],[text3]
),[text2]),[text1])

Of course you would use the logic that suits your needs.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "an" <[email protected]>
| Sender: "an" <[email protected]>
| Subject: MAX Function
| Date: Fri, 23 Jul 2004 07:49:29 -0700
| Lines: 12
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcRwxEG+g+ZeNoCHSGC5tknHsk4A4A==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.reports
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.reports:143321
| NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.public.access.reports
|
| Hello!
|
| In detail section I have Textboxes with numeric values
| through NZ function.
| I need, in another textbox, look the max value of the
| refered textboxes but I don't know how.
| I need help, please.
| Thanks in advance.
| an
|
|
|
|
 
Or you could put the following function in a regular module:



Public Function MaxValueVariantArray(ParamArray ValuesArray() As Variant) As
Variant

' ** THIS FUNCTION RETURNS THE MAXIMUM VALUE FROM AN ARRAY OF VALUES.

Dim xlngLB As Long, xlngUB As Long, xlngCnt As Long
Dim xvarTp As Variant
xlngLB = LBound(ValuesArray)
xlngUB = UBound(ValuesArray)
If xlngUB >= 0 And xlngLB >= 0 Then
xvarTp = ValuesArray(xlngLB)
For xlngCnt = xlngLB + 1 To xlngUB
If ValuesArray(xlngCnt) > xvarTp Then xvarTp = ValuesArray(xlngCnt)
Next xlngCnt
End If
MinValueVariantArray = xvarTp
End Function


and then use the function in the control source of the textbox:
=MaxValueVariantArray([text1],[text2],[text3],[text4])


--

Ken Snell
<MS ACCESS MVP>

Eric Butts said:
Hi,

It sounds like you need to use a nested IIF function. Example:

=IIF([text1]<[text2],IIF([text2]<[text3],IIF([text3]<[text4],[text4],[text3]
),[text2]),[text1])

Of course you would use the logic that suits your needs.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "an" <[email protected]>
| Sender: "an" <[email protected]>
| Subject: MAX Function
| Date: Fri, 23 Jul 2004 07:49:29 -0700
| Lines: 12
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcRwxEG+g+ZeNoCHSGC5tknHsk4A4A==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.reports
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.reports:143321
| NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.public.access.reports
|
| Hello!
|
| In detail section I have Textboxes with numeric values
| through NZ function.
| I need, in another textbox, look the max value of the
| refered textboxes but I don't know how.
| I need help, please.
| Thanks in advance.
| an
|
|
|
|
 
Hi!
Thanks for your reply.
Sorry for may delay.
Because I have many Textboxes, I opted for 2nd solution of
the Ken Snell.
Thanks for help.
an
-----Original Message-----
Hi,

It sounds like you need to use a nested IIF function. Example:
=IIF([text1]<[text2],IIF([text2]<[text3],IIF([text3]<
[text4],[text4],[text3]
),[text2]),[text1])

Of course you would use the logic that suits your needs.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03 -026.asp> and/or
to visit Windows Update at
 
KS,
Thanks for your reply and sorry for may delay.
Exactly! Only I change the penultimate row of the

MinValue...
to
MaxValue...

and work fine.
Many thanks for your help.

an
-----Original Message-----
Or you could put the following function in a regular module:



Public Function MaxValueVariantArray(ParamArray ValuesArray() As Variant) As
Variant

' ** THIS FUNCTION RETURNS THE MAXIMUM VALUE FROM AN ARRAY OF VALUES.

Dim xlngLB As Long, xlngUB As Long, xlngCnt As Long
Dim xvarTp As Variant
xlngLB = LBound(ValuesArray)
xlngUB = UBound(ValuesArray)
If xlngUB >= 0 And xlngLB >= 0 Then
xvarTp = ValuesArray(xlngLB)
For xlngCnt = xlngLB + 1 To xlngUB
If ValuesArray(xlngCnt) > xvarTp Then xvarTp = ValuesArray(xlngCnt)
Next xlngCnt
End If
MinValueVariantArray = xvarTp
End Function


and then use the function in the control source of the textbox:
=MaxValueVariantArray([text1],[text2],[text3],[text4])


--

Ken Snell
<MS ACCESS MVP>

Hi,

It sounds like you need to use a nested IIF function. Example:

=IIF([text1]<[text2],IIF([text2]<[text3],IIF([text3]< [text4],[text4],[text3]
),[text2]),[text1])

Of course you would use the logic that suits your needs.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-
026.asp> and/or
 
Aaarrgghhh!!! I made a typo. My apologies! Thanks for catching it!
Glad that it worked for you.

--

Ken Snell
<MS ACCESS MVP>

an said:
KS,
Thanks for your reply and sorry for may delay.
Exactly! Only I change the penultimate row of the

MinValue...
to
MaxValue...

and work fine.
Many thanks for your help.

an
-----Original Message-----
Or you could put the following function in a regular module:



Public Function MaxValueVariantArray(ParamArray ValuesArray() As Variant) As
Variant

' ** THIS FUNCTION RETURNS THE MAXIMUM VALUE FROM AN ARRAY OF VALUES.

Dim xlngLB As Long, xlngUB As Long, xlngCnt As Long
Dim xvarTp As Variant
xlngLB = LBound(ValuesArray)
xlngUB = UBound(ValuesArray)
If xlngUB >= 0 And xlngLB >= 0 Then
xvarTp = ValuesArray(xlngLB)
For xlngCnt = xlngLB + 1 To xlngUB
If ValuesArray(xlngCnt) > xvarTp Then xvarTp = ValuesArray(xlngCnt)
Next xlngCnt
End If
MinValueVariantArray = xvarTp
End Function


and then use the function in the control source of the textbox:
=MaxValueVariantArray([text1],[text2],[text3],[text4])


--

Ken Snell
<MS ACCESS MVP>

Hi,

It sounds like you need to use a nested IIF function. Example:

=IIF([text1]<[text2],IIF([text2]<[text3],IIF([text3]< [text4],[text4],[text3]
),[text2]),[text1])

Of course you would use the logic that suits your needs.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-
026.asp> and/or
Update site will
help


.
 
Back
Top