Using a Macro (Or Expression?) to affect visible

G

Guest

I think my question is simple, and therefore, I assume the answer is simple,
but I haven't been able to find it.

I did search the groups, and didn't find anything that really applied.

I have a checkbox (downtime). When I check it, I want two other fields
(downtime_start & downtime_stop) to be VISIBLE.

How do I accomplish that?

I thought I could do it in a macro. I created a macro, and then tried it on
my form, but I can't get it to work.

I then tried an Expression :

---------
If Downtime = True Then
[Downtime Start].Visible = True
[Downtime Stop].Visible = True
Else
[Downtime Start].Visible = False
[Downtime Stop].Visible = False
End If
---------

But that doesn't work either.

Any suggestions?
thank you,
Brady Weiss
(e-mail address removed)
 
G

Guest

Set the properties of your checkbox to call the macro.

In the macro include [Forms]![YourForm]![Downtime Start] and
[Forms]![YourForm]![Downtime Stop]
 
S

Steve Schapel

Brady,

Where are you trying to make this happen? "When I check it" would
probably indicate the After Update event of the checkbox... is that the
event you are using?

You didn't mention how you tried to set up the macro, so I can't comment
on why it didn't work. I guess it would involve a couple of SetValue
actions, something like this....
Condition: [downtime]=-1
Action: SetValue
Item: [downtime_start].[Visible]
Expression: Yes
Condition: ...
Action: SetValue
Item: [downtime_stop].[Visible]
Expression: Yes

The VBA code you did I would also expect to work. There is a confusion
in the name of the controls... in your code you refer to [Downtime
Start] and in your description you refer to downtime_start so you will
have to work out what it is. The code itself could be simplified to...
Me.Downtime_Start.Visible = Me.Downtime
Me.Downtime_Stop.Visible = Me.Downtime
 

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

Top