IIf A=1 then B=Visible

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
 
R

Rick B

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

In an unbound text box, put...

= IIF([myCheckBox]=1, myText,"")
 
G

Guest

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)
 
G

Guest

One more thing, if you try this code, then remove the Show days? From the
Control Source
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top