By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

I can't set Text property for a TextBox control to a string???

P: n/a
MLH
This property is only available only when the control has the focus...
Error #2185

I get the above error when code running in FormA is
trying to set the value of a hidden textbox on FormB
to a string. Here's the code I'm running. How can I
accomplish what I'm trying to do?

Forms!FormB!MyTextBox.Text = "Hello"
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"MLH" <CR**@NorthState.net> wrote in message
news:rd********************************@4ax.com...
This property is only available only when the control has the focus...
Error #2185

I get the above error when code running in FormA is
trying to set the value of a hidden textbox on FormB
to a string. Here's the code I'm running. How can I
accomplish what I'm trying to do?

Forms!FormB!MyTextBox.Text = "Hello"


The Text property is what you would use in VB. In Access you use the Value property.
Nov 12 '05 #2

P: n/a
MLH
On Wed, 24 Sep 2003 11:49:56 -0500, "Rick Brandt" <RB*****@Hunter.Com>
wrote:
"MLH" <CR**@NorthState.net> wrote in message
news:rd********************************@4ax.com.. .
This property is only available only when the control has the focus...
Error #2185

I get the above error when code running in FormA is
trying to set the value of a hidden textbox on FormB
to a string. Here's the code I'm running. How can I
accomplish what I'm trying to do?

Forms!FormB!MyTextBox.Text = "Hello"


The Text property is what you would use in VB. In Access you use the Value property.

Thx for the input, Rick. Here's what I came up with. It
works - except for when the string I'm trying to assign
is over 2048 chars long. I have VLS (very long strings)
to deal with and am now going to have to go BACK to
the drawing board on this. Suggestions?

Forms!FormB!MyTextBox.ControlSource = "=" & Chr$(34) & VLS & Chr$(34)
Nov 12 '05 #3

P: n/a
"MLH" <CR**@NorthState.net> wrote in message
news:t2********************************@4ax.com...
On Wed, 24 Sep 2003 11:49:56 -0500, "Rick Brandt" <RB*****@Hunter.Com>
wrote:
"MLH" <CR**@NorthState.net> wrote in message
news:rd********************************@4ax.com.. .
This property is only available only when the control has the focus...
Error #2185

I get the above error when code running in FormA is
trying to set the value of a hidden textbox on FormB
to a string. Here's the code I'm running. How can I
accomplish what I'm trying to do?

Forms!FormB!MyTextBox.Text = "Hello"
The Text property is what you would use in VB. In Access you use the Value

property. Thx for the input, Rick. Here's what I came up with. It
works - except for when the string I'm trying to assign
is over 2048 chars long. I have VLS (very long strings)
to deal with and am now going to have to go BACK to
the drawing board on this. Suggestions?

Forms!FormB!MyTextBox.ControlSource = "=" & Chr$(34) & VLS & Chr$(34)


I don't understand the problem. A TextBox can hold just about as much text as you
want to jam into it. I believe the limit is around 64,000 characters from the GUI
and even higher than that when done programmatically.

If the TextBox is bound to a character field in the underlying table, then you will
have a limit of 255 characters. In that case you need to change the field type to
Memo.
Nov 12 '05 #4

P: n/a
"Rick Brandt" <RB*****@Hunter.Com> wrote in message
news:bk************@ID-98015.news.uni-> >
Forms!FormB!MyTextBox.ControlSource = "=" & Chr$(34) & VLS & Chr$(34)


I don't understand the problem. A TextBox can hold just about as much text as you
want to jam into it. I believe the limit is around 64,000 characters from the GUI
and even higher than that when done programmatically.

If the TextBox is bound to a character field in the underlying table, then you will
have a limit of 255 characters. In that case you need to change the field type to
Memo.


In looking at this again I see you are attempting to set the ControlSource property
which does have a length limit. Why are you doing that? Just use...

Forms!FormB!MyTextBox = VLS

The Value property being the default, it does not need to be explicitly qualified.
Nov 12 '05 #5

P: n/a
MLH
>In looking at this again I see you are attempting to set the ControlSource property
which does have a length limit. Why are you doing that? Just use...

Forms!FormB!MyTextBox = VLS

The Value property being the default, it does not need to be explicitly qualified.

Sorry about the confusion. FormA was opening FormB in A_DIALOG
WindowMode which was halting code running in FormA. I had to close
FormB because processing was locked at that time. When FormB closed,
processing in FormA resumed with the next statement and that's where
the procedure was attempting to write the VLS to the control - only
the form was no longer in form view and I was getting an error. Had
nothing to do with writing VLS to textbox. Sorry.
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.