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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enable/Disable controls w/o new record creation

Status
Not open for further replies.

kellyputty

Technical User
Jul 28, 2005
29
0
0
US
I would simply like to enable/disable controls based on whether a checkbox is checked. However, the following code creates a record even before the actual update. For example, if I check the checkbox, then change my mind and uncheck it, there is a blank record inserted into table tblCarpenters.

How does one write code so that no records are created until an update, such as, navigating to the next record?

-----------------------------------------------------------

Code:
Private Sub Carpenter_Click()
       If Me.Carpenter.Value = True Then
       Me.tblVocations_ClientID = Me.tblClients_ClientID.Value
       Me.tblCarpenters_ClientID.Value = Me.tblClients_ClientID.Value
       Me.tblCarpenters_YearsExperience.Enabled = Carpenter
       Me.tblCarpenters_HasOwnTools.Enabled = Carpenter
       Me.tblCarpenters_NeedsTraining.Enabled = Carpenter
       Me.tblCarpenters_Certifications.Enabled = Carpenter      
    Else
        Me.tblVocations_ClientID = Null
        Me.tblCarpenters_ClientID.Value = Null
        Me.tblCarpenters_YearsExperience.Value = Null
        Me.tblCarpenters_YearsExperience.Enabled = False
        Me.tblCarpenters_HasOwnTools.Value = Null
        Me.tblCarpenters_HasOwnTools.Enabled = False
        Me.tblCarpenters_NeedsTraining.Value = Null
        Me.tblCarpenters_NeedsTraining.Enabled = False
        Me.tblCarpenters_Certifications.Value = Null
        Me.tblCarpenters_Certifications.Enabled = False
        
    End If
End Sub
 
If Me.NewRecord Then
If Carpenter = True Then
'Your code here
Else
Me.Form.Undo
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top