Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object required error

Status
Not open for further replies.

robins80

Programmer
Jun 13, 2007
4
US
Hello,

I have a form in Access with a text box called ChooseZone. I want to put the value of ChooseZone.Text into a variable called ThisText like so:

ThisText = ChoozeZone.Text

but when I run the application, the above line gets the oh-so-descriptive error "Object Required".

What gives? Shouldn't this be a simple operation?

Thanks,
* Robinson
 



Hi,
Code:
ThisText = [b]SomeFormObject.[/b]ChoozeZone.Text

Skip,

[glasses] [red][/red]
[tongue]
 
Furthermore, in Access, the Text property of a TextBox is only available when the control has the focus, so use its Value property instead.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I changed the line to this:

ThisText = ProgramForm.ChoozeZone.Text

And still got the same error.
 



Hit the Debug button when you get the error.

Select ProgramForm and view the Watch Window.

What does it say about this?

Skip,

[glasses] [red][/red]
[tongue]
 
Provided that ProgramForm is an open main form:
ThisText = Forms!ProgramForm!ChoozeZone.Value

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Actually, I decided to change my variable to a Variant and everything seemed to work fine. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top