Display a text box on a condition of another text box

Johnthelleader

Registered User.
Local time
Today, 01:14
Joined
Nov 8, 2006
Messages
27
I am trying to run a IF, THEN expression.

What I have created is :

Private Sub Form_Open(Cancel As Integer)

If Me!Type = "Workboat" Then Me!DWT.Visible = False
End

This works fine but where the TYPE field is enetred as another category other than workboat, the DWT field is still missing. Am I missing the Else part?

Please help!
 
Code:
If Me.Type = "Workboat" Then 
Me.DWT.Visible = False
Else
Me.DWT.Visible = True
End If
 
Thanks for doing that. I have posted your expression but it still doesn't work. I have looked at anything obvious but cannot see what it could be.

Perhaps you may have some suggestions?
 
Thanks Colin, I put it in the oncurrent function and it worked.

What I would like to do now is add another text box to the rule. The text box is called barrel capacity. I have written the following code but is not liked!

Private Sub Form_Current()
If Me![Type] = "Workboat" Then
Me![DWT].Visible = False
Me!Barrel_Capacity.Visible = False
Else
Me.[DWT].Visible = True
Me!Barrel_Capacity.Visible = True

I have tried inserting the brackets but they are removed by defult.

Appreciate your comments and help.

End If
End Sub
 
Code:
If Me.Type = "Workboat" Then 
Me.DWT.Visible = False
Me.Barrel_Capacity.Visible = False
Else
Me.DWT.Visible = True
Me.Barrel_Capacity.Visible = True
End If

Col
 
That's great thank you. If say I wanted to add another text entry in the TYPE field how is that done? So if Workboat and Crewboat is entered.

Thanks
 
Code:
If Me.Type = "Workboat" or Me.Type = "Crewboat" Then 
Me.DWT.Visible = False
Me.Barrel_Capacity.Visible = False
Else
Me.DWT.Visible = True
Me.Barrel_Capacity.Visible = True
End If

Col
 

Users who are viewing this thread

Back
Top Bottom