Re: How to do a Horizontal Min or Max
- From: "Graham Mandeno" <Graham.Mandeno@xxxxxxxxxxxxx>
- Date: Wed, 26 Nov 2008 09:53:31 +1300
Hi Matt
Reminds me of a song from "Oklahoma!" - "With me it's all or nuthin'" :-)
You can use a trick here - the "real" value of the boolean True is -1, and
False is 0. So, if you add all four IsNull()s together, you want to get
either 0 or -4.
Private Function SetButtonStatus()
Dim iTotal as Integer
iTotal = IsNull(MonthLowChosen) + IsNull(MonthHighChosen) _
+ IsNull(LowBOMOHChosen) + IsNull(HighBOMOHChosen)
Command7.Enabled = (iTotal = 0) or (iTotal = -4)
End Function
Then, instead of individual AfterUpdate events for each of the textboxes,
you can just set their AfterUpdate properties to:
=SetButtonStatus()
Also, I recommend you rename the command button. "Command7" means
absolutely nothing, while "cmdPrintReport" is much more meaningful and will
help you to understand what its purpose is when you revisit this form in a
year's time.
I think we're close to a solution for the report headers... watch this
space.
--
Good Luck :-)
Graham Mandeno [Access MVP]
Auckland, New Zealand
<doyle60@xxxxxxx> wrote in message
news:3c8281d8-d2ac-4911-b0bb-7cd58347e3ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks. One more little tiddly problem I can't solve, but tried. I
only want the Print command button to light up if all four of our
filters are null or if all four are filled in. If there is just one
filled in, or two, or three, the print button should not light up.
I put this in the after update of the four controls (but it doesn't
work):
'If IsNull(MonthLowChosen) And IsNull(MonthHighChosen) And IsNull
(LowBOMOHChosen) And IsNull(HighBOMOHChosen) Then 'Command7.Enabled =
True
'Command7.Enabled = True
'Else
'Command7.Enabled = False
'End If
'If Not IsNull(MonthLowChosen) And Not IsNull(MonthHighChosen) And Not
IsNull(LowBOMOHChosen) And Not IsNull(HighBOMOHChosen) Then
'Command7.Enabled = True
'Else
'Command7.Enabled = False
'End If
I'm not sure if it is one of those things where the box is null when I
open (IsNull) but when I clear it out after putting something in, it
is not the same null (it's "").
Thanks,
Matt
.
- References:
- How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- Re: How to do a Horizontal Min or Max
- From: Graham Mandeno
- Re: How to do a Horizontal Min or Max
- From: doyle60@xxxxxxx
- How to do a Horizontal Min or Max
- Prev by Date: Re: SQL Server Express versus Access (In the World Series of Love)
- Next by Date: Debugging stopped Access 2007 mdb not accdb
- Previous by thread: Re: How to do a Horizontal Min or Max
- Next by thread: Assistance required with query
- Index(es):