Ms Access

  • Thread starter Access General Questions
  • Start date
A

Access General Questions

what code is need to have a text box properties enbled = no when another text
box receive an entery?
 
S

schasteen

In the after update of the text box that recieves the entry

If isnull(Me!textbox1) then
Me!textbox2.enabled = true
else
Me!textbox2.enabled = false
end if

I assumed that if somebody comes back and deletes the data in textbox1 you
would then want the other enabled again
 
D

Dirk Goldgar

"Access General Questions" <Access General
[email protected]> wrote in message
what code is need to have a text box properties enbled = no when
another text box receive an entery?

By "receive and entery", do you mean that when ever this other text box
has any value in it, the first text box should be disabled? For that
you'd need code in two places: in the form's Current event (to set the
initial enabled status and make it right for existing records), and in
the AfterUpdate event of the other combo box. Example code might look
like this:

'----- start of example code -----
Private Sub Form_Current()

Me.Textbox1.Enabled = Not IsNull(Me.Textbox2)

End Sub

Private Sub Textbox2_AfterUpdate()

Me.Textbox1.Enabled = Not IsNull(Me.Textbox2)

End Sub
'----- end of example code -----
 
Top