What Is The Difference

D

DS

What is the difference?
The .Text , does it do or mean something
Thanks
DS

Me.txtLogOn.Text = "123"
Me.txtLogOn = "123"
 
D

Dennis

In this example, there is no difference. When you do not supply a property
with a control, then the default is assumed. The default property of a text
box is .Text
 
L

Linq Adams via AccessMonster.com

Not in VBA it isn't! In VBA the Default Property of a textbox is Value!

Me.txtLogOn = "123"

is the same as

Me.txtLogOn.Value = "123"

The Value Property holds the data that's been assigned to that control.

The Text Property holds that data that is currently ***showing*** in the
textbox, and can only be accessed ***while the textbox has focus.***

If "!23" has been entered in the textbox named txtLogOn and the user moves to
another field, the Value of txtLogOn is now "123." If the use returns to
txtLogOn and enters "456" and leaves the cursor in the textbox then

Me.txtLogOn.Value = "123"

but

Me.txtLogOn.Text = "456"

In this case the Value property and the Text property are not the same!

This is often confused because in Visual Basic (not Visual Basic for
Applications) the Default Property of a textbox ***is*** Text!
 
D

DS

So if I took code from VB6 and it says
Me.TxtOne.GetFocus
Me.TxtTwo = Me.TxtOne.Text

What would this be in VBA
just
Me.TxtTwo=Me.TxtOne

Would the value be the same?

Thanks
DS
 

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

Top