Locking a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a new database and I need to be able to lock certain fields
after and date has been entered.
I am using this code (see below) which works in another database but for
some reason it does not want to work my new database. So, if someone can
tell me of another way I will be very grateful..


Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "LOCK" Then
ctl.Locked = Not IsNull(Me.txtdateresolved)
End If
Next ctl
 
Have you set the .Tag property of fields you want to be Locked to "LOCK"?
You can do this in Form Design view ... just highlight the form, open the
Properties dialog and click the Other tab .. the Tag property is there ...
 
Raj said:
I am creating a new database and I need to be able to lock certain
fields after and date has been entered.
I am using this code (see below) which works in another database but
for some reason it does not want to work my new database. So, if
someone can tell me of another way I will be very grateful..


Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "LOCK" Then
ctl.Locked = Not IsNull(Me.txtdateresolved)
End If
Next ctl

Forgive me for asking the obvious, but did you enter "LOCK" into the Tag
property of the desired controls?
 
Yes, I set the fields to LOCK and it locks all the records until you close
the database and reopen it and then none of the records are locked. This is
driving me crazy because i have used this in two other database and it work
fine..
 
When you say you "set the fields to lock", do you mean you set the fields
..Tag property to "LOCK", or you set the fields .Locked property = True?

To recap: Have you set the .Tag property of every field you want to toggle
to "LOCK"?
 
Yes, I get the Tag property to "LOCK".

Scott McDaniel said:
When you say you "set the fields to lock", do you mean you set the fields
..Tag property to "LOCK", or you set the fields .Locked property = True?

To recap: Have you set the .Tag property of every field you want to toggle
to "LOCK"?
 
Back
Top