How do I disable a subform on a tab control?

Robert C

Registered User.
Local time
Today, 17:54
Joined
Mar 27, 2000
Messages
88
Can anybody tell me how I disable a subform which is located on a tab control.

I have used the following code on the AfterUpdate event of an option group which determines whether the subform should be enabled. The code is also on the OnCurrent event of the main form.

If Me.grpDelivery = 4 Then
Forms![frmOrders]![sbfDeliveryDetails].Enabled = True
ElseIf Me.grpDelivery > 4 Then
Forms![frmOrders]![sbfDeliveryDetails].Enabled = False
ElseIf Me.grpDelivery < 3 Then
Forms![frmOrders]![sbfDeliveryDetails].Enabled = False
End If

The subform is disabled in that it will not accept data, but it is not 'greyed out' as you would normally expect.

Can anyone help me.

Thanks in advance.
 
I'm not sure if there is any way of making a subform grey out when disabled.

You could make it disappear though if you want by doing:
Forms![frmOrders]![sbfDeliveryDetails].Visible = False

In fact if you place a disabled text box of the same size behind the subform, when the subform is made invisible, it will have the same effect visually as greying out the subform.
Crude, I know, but the best I can think of.

HTH

Mike
 
If you want a subform to appear greyed out when it is disabled, I think you have to reference each control on the subform and disable it which can be done using this code

With Me![yourSubformName].Controls
![yourControlName].Enabled = False
![yourNextControlName].Enabled = False
etc...
End With

There are probably more elegant ways of coding this but providing there are not too many controls on your subform then this will do the trick.

Good luck
Rob
 

Users who are viewing this thread

Back
Top Bottom