CommandBar ACtiveX with MS Access... |
Post Reply |
Author | |
derek
Newbie Joined: 19 May 2008 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 20 May 2008 at 12:15am |
I am hoping someone will be nice enough to help a codeJock beginner. I'm an Access 2002/2003/2007 developer trying to implement some menubars and toolbars as a replacement for the ribbon(which my customers hate). I understand I must use commandbarsframe and I've successfully designed a couple of nice toolbars using the designer. I drop a commandbarsframe on an access form, load the xcb files, adjust the size a little, and it looks good.
Here's my problems/questions.
1/. if I want 2 toolbars on one form, do I need 2 commandbarsframe(s) or is there a way to fit them both in 1 frame. So far I' m using 2.
2/. I studied the object browser but I can't seem to access any of the objects with vba. For instance how do I access the CommandBarOptions object (or can I access it)?
I tried this in both form_open and form_load ...
dim cbo as commandbaroptions
but then I need something like
set cbo = ????? (what?)
If I don't "set" it to something it seems I can't use it.
similarly, how can I programatically access the commandbarsframe object, and the globalsettings object? What works in vb doesn't seem to work in Access vba.
3/. How do I make it work without the ocx license file? Whenever I remove the license (as I legally must) the activex controls come up with the dreaded "Control is empty" error. I read the tutorial about including license information by loading it into the globalsettings. I followed those instructions exactly but it doesn't seem to help.
Thanks for any pointers you can give.
Derek.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, 1. it depends how they have to be located. If together - you need 1 frame. if in different position of screen - 2 frames.
2. It works for me:
Dim cbo As CommandBarsOptions
Set cbo = CommandBarsFrame2.Options |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
derek
Newbie Joined: 19 May 2008 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
1. I need them together. But using designer how do I force controls to be on 2 different rows? Whenever I add a new control it always goes on the right-hand end until it exceeds the form width, then it wraps. That's not what I want.
2. What is "CommandBarsFrame2"? Is that just the name property of the CommandBarsFrame? Assuming that's what you mean - it does not work for me...
Dim cbo As CommandBarsOptions
Set cbo = MyToolbar.Options 'fine - no errors so far
'test read any one option with messagebox...
msgbox cbo.showexpandbuttonalways
'ERROR "Object variable or With block variable not set"
when typing the messagebox line, Access does show me a dropdown list of properties of Options, so something is trying to work. But I always et that error when trying to access any property.
Thanks - Derek
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Just move it in designer to second row.
CommandBarsFrame2 is name of object that Access assigned to ActiveX.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
derek
Newbie Joined: 19 May 2008 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
1/. I will try & let U know.
2/. That is the name property. U can rename it whatever you want. I call it "Toolbar1" You did not answer my question. Why is the cbo object empty even after I set it to the commandbarsFrame.options?
This code also fails
dim cbf as commandbarsframe
dim cbo as commandbarsoptions
set cbf = toolbar1 'PRODUCES "TYPE MISMATCH ERROR"
set cbo = cbf.options 'CBO has value of "NOTHING" after this.
Basically I seem unable to assign any CodeJock objects to any vba object variables.
So to cut to the chase - how the heck do I read and write the options?
Derek
|
|
derek
Newbie Joined: 19 May 2008 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Oleg:
After three days of tearing my hair out I found how to do it
dim cbf as XtremeCommandBars.CommandBarsFrame
dim cbo as commandbarOptions
me.visible=true
doevents
set cbf = Toolbar1.object
set cbo = cbf.options
... and this has to be done in form_load NOT form_open, AFTER control has become visible, hence the me.visible=true command.
Jeez Oleg, you're supposed to be chief developer. You invented the object property. Why the heck couldn't you just tell me to use it instead of all that BS about "works for me." ?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
if you tried my code first, you'd save 3 days.
dim cbo as commandbarOptions
set cbo = Toolbar1.options
do same.
"Object" is property that Access add for any ActiveX object. strange that you work with Access and don't know it
;-) |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |