Locking a field

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
 
S

Scott McDaniel

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 ...
 
R

Rick Brandt

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?
 
G

Guest

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..
 
S

Scott McDaniel

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"?
 
G

Guest

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"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top