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

locking a field

Status
Not open for further replies.

fatz09

MIS
May 19, 2003
30
0
0
GB
I have created a database and I need to lock certain fields when I update a customer but i dont need the field locked when I use the form to add a new customer. Can someone please help me.


Fatz09
 
Hi,
This may or may not help. I have an existing question in thread thread181-586685 where I conditionally lock a form (similar to locking a field) may help you out. Keep an eye out for an resolution to my problem as you may need to watch out for it as well.
Good luck!
 
As you probably know, you can open a form in either data entry or non-data entry mode using the DoCmd.OpenForm syntax and arguments.

Probably the easiest way to handle this is to set those fields you want locked when not in data entry mode, to Locked = True.

Then in the OnOpen event of the form, add the following:

If Me.DataEntry = True Then
Me.Field1.Locked = False
Me.Field2.Locked = False
Me.Field3.Locked = False
...
End If

Use your own field names of course.
 
ReluctantDataGuy,

Thanks for the help. It worked perfectly.

Fatz09
 
Incidentally, when the entry form is complex enough, I find it helpful to use two separate forms: one for new entries only, and another for viewing existing entries.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top