Hi Madhu,
Are the three fields you mention [name, ishemarried, wifename] in a Table - or are they on a Form?
Assuming that your Table has Name, IsHeMarried & WifeName fields:
1. Make sure that the IsHeMarried field in the Table is a Yes/No type [Boolean].
2. Create a Form based on the Table.
3. Access should create the Form with a Check Box for the 'IsHeMarried' field.
4. In your Data Entry Form - set the WifeName field Visible property to No.
5. Select the Check Box - Right-Click - and open Properties.
6. In the Properties -> Event Tab -> On Click -> click the [...] elipsis to the right and then select Code Builder.
You will get something that looks like this:
Code:
Private Sub Married_Click()
End Sub
7. Add this between the two lines [Private Sub . . . & End Sub].
Code:
Me.WifeName.Visible = True
Me.WifeName.SetFocus
When you run the Form, the WifeName field will not be visible.
If you click the IsHeMarried Check Box - the WifeName field will become visible and the cursor will be in that field ready for you to type in the wife's name.
I hope this helps.
P.S. You should try not to have a field called 'name' - because 'name' is a reserved word in Access/VBA. I usually use substitutes like 'CustomerName' . . . or 'StudentName' . . . or 'EmployeeName' - when I have a name field.