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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cbrCtl.text won't work form me. help please 1

Status
Not open for further replies.

MFFL

Vendor
Nov 20, 2002
26
US
i get:

Run-time error '-2117467259(50004005)':

Method 'Text; of object'_CommandBarComboBox' failed

when i try to execute this:

Public Function CmdBarChangeText()
Dim cbr As CommandBar, Dim cbrCtl As CommandBarControl ' Set a reference to the Access menu bar
Set cbr = CommandBars(MyCommandBarName) ' Set a reference to the Print Control on the Menu Bar
Set cbrCtl = cbr.Controls("My Number")
cbrCtl.TooltipText = "successfully changed" ' this works
cbrCtl.Text = "Something Else" 'This causes above error
Set cbrCtl = Nothing
Set cbr = Nothing
End Function

is my problem utilizing a controlcombobox in the first place? all that is in the field is the number/year anniversary of subject
MMFL-
Mavericks Fan For Life
 
cbrCtl is declared as a CommandBarControl. CommandBarControl objects don't have a Text property, and that's why you get an error.

If you change the Dim statement to
Dim cbrCtl As CommandBarComboBox
it should work.
Rick Sprague
 

RickSpr

yes, that worked great!

it must've seen so obvious to you. i'm very thankful you took the time to reply and point it out. that's why i gave you a star. MMFL-
Mavericks Fan For Life
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top