Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yes/No Field Linked to Date Field 1

Status
Not open for further replies.

kcbeckwith

Technical User
Sep 2, 2004
12
US
Is there a way that if I have a Yes/No Field and a Date Field, that when the Yes/No field is checked, that it would fill in the current date in the date field. Also, it would not allow anyone to uncheck the Yes/No Field once it's checked, nor change the current date. I'm trying set up a tracking program and need to be able to lock down the fields, so that user's cannot manipulate the dates once the Yes/No field has been checked. Any help would greatly be appreciated.
 
In the AfterUpdate event of the check box, if true then set the date field to the current date.
Code:
Private Sub Check0_AfterUpdate()

    If (Check0) Then Text2.Value = Date
    
End Sub
In the OnCurrent event of the form, check the yes/no field and if true, then disable both the yes/no field and the text box. Else enable them.
Code:
Private Sub Form_Current()

    Text2.Enabled = Not Check0
    Check0.Enabled = Not Check0
    
End Sub
 
How are ya kcbeckwith . . . . .

Just a little heads up . . . [purple]After locking[/purple], have you given thought to say . . . . [purple]how you will correct typos?[/purple]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top