IIf A=1 then B=Visible

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

this is what i have:

myText (unbound) Control Source: =Sum(DateDiff("d",[StartDate],[EndDate]))

myCheckBox (unbound) Control Source: Show days?

when the report loads, you are asked "show days?", when you enter 1, the box
is checked, 0=unchecked.

now i need this.

if myCheckBox=1 myText=visible
else, not visible

i'm foggy on what the code should be and even foggier on when/where it
should be. i can put it in myForm's OnOpen event or maybe the OnActivate
event.

thanks again, all!

/amelia
 
Not tested, but I think the following is correct...

In an unbound text box, put...

= IIF([myCheckBox]=1, myText,"")
 
On the OnOpen event of the report you can write the code

Dim Respone as string
Respone = inputBox("Show days?")
Me.myText.Visible = (Respone = "1")
Me.myCheckBox = Val(Respone)
 
Ofer-

in the code Me.myText.Visible = (Respone = "1") and Me.myCheckBox =
Val(Respone)

is "Respone" supposed to be "Response"?

thanks!

Ofer said:
On the OnOpen event of the report you can write the code

Dim Respone as string
Respone = inputBox("Show days?")
Me.myText.Visible = (Respone = "1")
Me.myCheckBox = Val(Respone)

--
I hope that helped
Good luck


aaearhart said:
this is what i have:

myText (unbound) Control Source: =Sum(DateDiff("d",[StartDate],[EndDate]))

myCheckBox (unbound) Control Source: Show days?

when the report loads, you are asked "show days?", when you enter 1, the box
is checked, 0=unchecked.

now i need this.

if myCheckBox=1 myText=visible
else, not visible

i'm foggy on what the code should be and even foggier on when/where it
should be. i can put it in myForm's OnOpen event or maybe the OnActivate
event.

thanks again, all!

/amelia
 
thanks! i sorted it. here's what i ended up with:

Private Sub Report_Open(Cancel As Integer)
Dim Respone As String
Respone = InputBox("Show total travel days?")
TotalDays.Visible = (Respone = "yes")
ShowDays = Val(Respone)
End Sub

Ofer said:
On the OnOpen event of the report you can write the code

Dim Respone as string
Respone = inputBox("Show days?")
Me.myText.Visible = (Respone = "1")
Me.myCheckBox = Val(Respone)

--
I hope that helped
Good luck


aaearhart said:
this is what i have:

myText (unbound) Control Source: =Sum(DateDiff("d",[StartDate],[EndDate]))

myCheckBox (unbound) Control Source: Show days?

when the report loads, you are asked "show days?", when you enter 1, the box
is checked, 0=unchecked.

now i need this.

if myCheckBox=1 myText=visible
else, not visible

i'm foggy on what the code should be and even foggier on when/where it
should be. i can put it in myForm's OnOpen event or maybe the OnActivate
event.

thanks again, all!

/amelia
 
Back
Top