Hidding Textbox in a Access form

A

AlfaSierra

While designing a Form:
I would like to place a Textbox that will appear or be hidden depending on a
previous input: For example:

On a Personal Form, a textbox called "Spouse's Name" would only appear if
the input on a previous Texbox called "Marital Status" was = married.

or:

On a Tool Form, - Punches - On top of the BMP of the tool I can place a
textbox for "angle of chamfer" that would only appear if the Punch was the
"chamfering type"

I would appreaciate your help.
A.Soares
Portugal
 
L

Linq Adams via AccessMonster.com

I've used textbox names that don't include spaces/punctuation marks, which is
really the way you should do it. Doing otherwise generates more work for
yourself as well as more opportunities for error.

In the properties box for the SpousesName you need to goto to Format then set
the Visible property to NO

Then use this code"

'This controls the visibilty of SpousesName after the MaritalStaus is entered

Private Sub MaritalStatus_AfterUpdate()
If Me.MaritalStatus = "Married" Then
SpousesName.Visible = True
Else
SpousesName.Visible = False
End If
End Sub

'This controls the visibilty of SpousesName when you return to the record

Private Sub Form_Current()
If Me.MaritalStatus = "Married" Then
SpousesName.Visible = True
Else
SpousesName.Visible = False
End If
End Sub
 

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