extracting text from textBox, any ideas how

ivan86s

Registered User.
Local time
Today, 01:08
Joined
May 20, 2008
Messages
10
I have this problem:

User types a formula into text box
click a button
VBA takes the text from text box
performs some operations on it
and prints modified formula into a Label

when i try to extract text form text box it gives me an error
the folowing is just to extract the text and save int into string called "syn"
PHP:
Private Sub Command80_Click()
   Dim syn As String 
   Me!TextSyn.SetFocus
   Set syn = Me!TextSyn.text 
End Sub
"TextSyn" is the name of the textBox

the error i get is Compile Error: Object Required
and "syn =" is highlited

i don't understand this error because that how i always extract data from controls, it's only when i try to extract from textbox it gives me an error.

so if anyone know what the problem is and how to fix it i'd really appreciate that.

thanks in advance
 
Code:
Dim syn As String 
Me.TextSyn

???
 
Code:
Dim syn As String 
syn = Me.TextSyn

???
 
what do you mean?

thats how i get things form things
to get index of a list i write
Code:
Index = Me!listBox01.ListIndex
and it works fine
 
A list box is a bit different than a text box. Not sure what you're getting at? Did the sample I gave work? (At least the second one - I am not able to edit a post and the first one had an obvious error)
 
nope, i didn't work, gives the same error in the same place

any other ideas??
 
Forgive my mis-understanding and help me to clarify your problem: So you have a text box with a value and you simply want to take what the user places in the text box and assign it to a text string variable?
 
yes that is exactly what i want, i know it sounds simple but i can't find any tutorial that would teach that, it's ptobably too easy.
 
Try this. Create a new form. Then create a text box named txtOne. Then create a command button and put this code in it:

Code:
dim strMyString as string
strMyString = me.txtOne
msgbox strMyString

Then save the form and open it, put your name in the text box and hit the command button and see what happens - ?
 
Exellent, it works thanks, i guess the problem was the "Set" part of it, thank you very much
 
Cool - Glad you have it working. I was beginning to think I was missing something basic - :o
 

Users who are viewing this thread

Back
Top Bottom