How do I make a Control Visible/Enabled based on the value of anot

S

Sidz

Hi,
I have a form for making bookings for a community centre. On Friday and
Saturday nights, the client may book the centre for an additional 2hrs.

So in my form, I have a control called 'Extension' which is a Yes/No
control. I want it to be enabled or displayed only when the control 'SlotID'
is '15' or '20'. How do I do this? (For your Info: In a week there can only
be 21 booking slots, 3 each day. So I just made a table listing the 21
possible slots! SlotID refers to the slot)

I tried a few methods using the expression builder - didn't have any succes
though!

Thanks for taking time to read and respond ;-)
 
J

Joshua A. Booker

Sidz,

In the OnCurrent procedure for the form put this code:

Private Sub Form_Current()

Select Case Me!SlotId
Case 15, 20
Me!Extension.Enabled = True
Case Else
Me!Extention.Enabled = False
End Select

End Sub

Then in the AfterUpdate procedure of SlotId control call it like this:

Private Sub SlotID_AfterUpdate()

Form_Current

End Sub

HTH,
Josh
 
S

Sidz

Thanks. It works.

Joshua A. Booker said:
Sidz,

In the OnCurrent procedure for the form put this code:

Private Sub Form_Current()

Select Case Me!SlotId
Case 15, 20
Me!Extension.Enabled = True
Case Else
Me!Extention.Enabled = False
End Select

End Sub

Then in the AfterUpdate procedure of SlotId control call it like this:

Private Sub SlotID_AfterUpdate()

Form_Current

End Sub

HTH,
Josh
 

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