Print Page | Close Window

CommandBar ACtiveX with MS Access...

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10693
Printed Date: 16 June 2025 at 3:40pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CommandBar ACtiveX with MS Access...
Posted By: derek
Subject: CommandBar ACtiveX with MS Access...
Date 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.
 



Replies:
Posted By: Oleg
Date Posted: 20 May 2008 at 12:36am

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


Posted By: derek
Date Posted: 20 May 2008 at 11:43am
Originally posted by oleg oleg wrote:

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
 
 
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
 
 


Posted By: Oleg
Date Posted: 20 May 2008 at 1:24pm
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


Posted By: derek
Date Posted: 20 May 2008 at 2:19pm
Originally posted by oleg oleg wrote:

Hello,
 
1/. Just move it in designer to second row.
 
2/. CommandBarsFrame2 is name of object that Access assigned to ActiveX.
 
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


Posted By: derek
Date Posted: 20 May 2008 at 8:08pm
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." ?
 


Posted By: Oleg
Date Posted: 21 May 2008 at 1:34am
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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net