Solved Reference a Property..... (2 Viewers)

MaryamF

New member
Local time
Today, 03:28
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 ....
 

Minty

AWF VIP
Local time
Today, 11:28
Joined
Jul 26, 2013
Messages
10,371
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:28
Joined
Oct 29, 2018
Messages
21,473
Also, I'd recommend you use Null.
Code:
Me.TenantName = Null
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:28
Joined
Sep 21, 2011
Messages
14,301
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.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:28
Joined
Feb 28, 2001
Messages
27,186
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

Top Bottom