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

Lock Field Part 2

Status
Not open for further replies.

nickotine

Programmer
Nov 27, 2001
23
GB
Hi
Problem, I've got 2 fields in a Form (Name & Age), what I want to do is: -
once a name has been entered I want to automatically lock the age field so if anybody try's to enter a number value then the field wont allow input.

I've tried this: -
If name Is Not Null Then age . Locked = True

This Formula was a event procedure on the name field but wont work.

I am using access 97.

Can anybody help.

Nickotine
 
FIrst off, what are you doing with a discrete AGE field anyway? Shouldn't you be calculating that from a date somewhere?

Secondly, if all you want to do is LOCK the text box after a change in another text box, try this:

Public Sub TextBox1_Change
Me!TextBox2.Locked = True
End sub

However, what if I just tab in to the first T/B and then tab out? I haven't triggered the CHANGE event. So might you also need to trap the EXIT or LOST FOCUS event?

Why not just lock the AGE guy all the time?

Jim












Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Thanks Jim
I created this form (name, age) as a test on the original where their are 4 fields: -

Charge number
delivery note number
temp number
No number inputted

If any of the first 3 fields are inputted then the 4th field I want to be able to lock (no number inputted)

Nickotine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top