Command button, need to lock data and insert date.

kiask2343

New member
Local time
Today, 13:27
Joined
Sep 14, 2006
Messages
6
Well the title says it all. I need to create a button to lock the info on the form so it can't be edited and at the same time insert the date. Any ideas?
 
Hello

What you want to do is cycle through the CONTROLS collection and set the ENABLED or LOCKED property or both.
'
The basic structure is below.
'
Sub ToggleControl(frm As Form)
Dim ctl As Control
Dim intI As Integer, intCanEdit As Integer
Const conTransparent = 0
Const conWhite = 16777215
For Each ctl in frm.Controls
With ctl
Select Case .ControlType
Case acLabel
If .SpecialEffect = acEffectShadow Then
.SpecialEffect = acEffectNormal
.BorderStyle = conTransparent
intCanEdit = True
Else
.SpecialEffect = acEffectShadow
intCanEdit = False
End If
Case acTextBox
If .SpecialEffect = acEffectNormal Then
.SpecialEffect = acEffectSunken
.BackColor = conWhite
Else
.SpecialEffect = acEffectNormal
.BackColor = frm.Detail.BackColor
End If
End Select
End With
Next ctl
If intCanEdit = IFalse Then
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
Else
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
End With
End If
End Sub
'
Regards
Mark
 

Users who are viewing this thread

Back
Top Bottom