enable property

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

Guest

This locks my field from entering any data
Me.Feildname.Enabled = IsNull(Me.Fieldname) but i want it to enabled only
after i enter a number in this field can this be done
 
Where are you putting that code?

In the after update for the field you want an entry in? In the "Current"
event for the form so it sets that every time you move from one record to
another? In both?
 
"but i want it to enabled only after i enter a number in this field "

Your question does not make sense.
 
i have the code set in the "on current" but it locks right away i want
it to lock once i tab off
 
Putting the code in the "current" event will cause it to fire as you move
from one record to another. You would also need to put it in the "change"
event for a particular field if you want it to fire after you make an entry
in a field of a new record.
 
Private Sub MyControl_AfterUpdate()
Me.MyControl2.Enabled = Not IsNull(Me.MyControl)
End Sub

Brian
 
putting that code fires as soon as you open the form it wont even let me
enter anything in that field
 
Okay, what are you trying to do? If you want to lock the field when an
entry exists in that field, you'd apply your code in the current event and
the Change or Update event of the particular field.

If you put it in the Current event, then when you open the form it will look
at the currently displayed record and make the field enabled or not
depending on whether there is an entry in that field. When you press PAGEUP
or PAGEDOWN or use the navigation buttons to move to another record, then it
will enable that field based on whether there is an entry in the currently
displayed field.

Putting it elsewhere in the code would allow you to make an entry in a new
record, once you tab out of the field, it would update the enabled property.
 

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

Back
Top