Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text box value based on multiple criteria being met... 1

Status
Not open for further replies.

straybullet

IS-IT--Management
Jun 5, 2003
593
0
0
US
How would I write this in Access?

=if(and([BDoor_amt]>0,[WLine_amt]>0,[GServDoor_amt]>0,[BICabsBar_amt]>0,[KitBICabs_amt]>0,[FP_amt]>0,[TwoPerWhirlTub_amt]>0,[PDAtticStair_amt]>0),"","None Selected")

This is for a report for which I have already set up the text boxes to "disappear" when there is no value. However, if no selections are made in the section, Id like to display "None Selected" in a text box rather than simply having the section title with no note.

Let them hate - so long as they fear... Lucius Accius
 
One question before responding, will the report only ever display one of the mentioned fields or does the possiblity exist that more than one field would need to be displayed at any given time?
 
At any given time one or all of the options could need to be displayed. What I am trying to accomplish is to have "None Selected" visible only if all option textboxes are null. If any are not null, I'd like to have the unbound textbox NoneSelectedtxt value=null and therefore "shrink" (be invisible)

Let them hate - so long as they fear... Lucius Accius
 
Here's my latest try...
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.PCB_amt = Null And Me.BDoor_amt = Null And Me.WLine_amt = Null And Me.GServDoor_amt = Null And Me.BICabsBar_amt = Null And Me.KitBICabs_amt = Null And Me.FP_amt = Null And Me.TwoPerWhirlTub_amt = Null And Me.PDAtticStair_amt = Null Then

Me.NoneSelected.Visible = True
Me.NoneSelected.Value = "None Selected"

Else

Me.NoneSelected.Visible = False

End If


End Sub
Needless to say, doesn't work

Let them hate - so long as they fear... Lucius Accius
 
How about something like this on the report open event...

dim bln_noVal as boolean
bln_noVal = false

if (isnull(a) or a = "") and (isnull(b) or b="") and (isnull(c) or c="") then
bln_noVal = true
end if

if bln_noval = true then
me.nonesel.visible = true
me.nonesel.value = "None Selected"
end if
'************END CODE********

I did not test this but it is simal to something I have recently done.

Good Luck
 
TYVM!!

With a minor adjustment, it works perfectly!

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If IsNull(Me.PCB_amt) And (IsNull(Me.WLine_amt)) And (IsNull(Me.GServDoor_amt)) And (IsNull(Me.BICabsBar_amt)) And (IsNull(Me.KitBICabs_amt)) And (IsNull(Me.FP_amt)) And (IsNull(Me.TwoPerWhirlTub_amt)) And (IsNull(Me.PDAtticStair_amt)) Then

Me.NoneSelected.Visible = True
Me.NoneSelected.Value = "None Selected"

Else

Me.NoneSelected.Visible = False

End If


End Sub

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top