Solved Reference a Property.....

MaryamF

New member
Local time
Today, 09:32
Joined
Nov 12, 2007
Messages
14
I appreciate your time and help in advance.

I get this error message :

"You can't reference a property or method for a control unless the control has the focus."

on this line :
"Me.TenantName.Text = """

I need the textbox TenantName to be cleared ....
 
The .Text property isn't needed to clear a textbox control, it's used to get the actual characters as they are typed, normally in conjunction with the change event.

Try simply
Code:
Me.TenantName = ""
Which is actually the same writing
Code:
Me.TenantName.Value = ""
You can drop the .Value as it is the default property
 
Also, I'd recommend you use Null.
Code:
Me.TenantName = Null
 
I appreciate your time and help in advance.

I get this error message :

"You can't reference a property or method for a control unless the control has the focus."

on this line :
"Me.TenantName.Text = """

I need the textbox TenantName to be cleared ....
It means what it says for .Text
Set focus to it first, though as mentioned there is no need if you leave off the .Text property.
 
Access has many dynamically defined properties that are situational.

For example, a bound control on a form has a .OldValue as well as a .Value - and it has a .ControlSource. An unbound control only has .Value and (a blank) .ControlSource. No .OldValue, so no Undo operation either.

Similarly, when a control has focus, it has certain properties that relate to the dynamics of how you display the information being entered through that control. Once the focus changes, these properties ALSO vanish (and appear instead on the next control in TabStop order). The .Text property is one example.
 

Users who are viewing this thread

Back
Top Bottom