473,788 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access 2003 generate window selectors

22 New Member
Hi

I've been setting up a custom toolbar on start up for the application via VBA code.

I've generated, for the custom menu bar, the drop-down menus File, Edit, Window and Help and successfully added controls to each of them except for Window. I can't seem to add the funcitionality where upon opening a form it will add itself to the Window menu as an item so when it has lost focus it can be selected again.

I looped through a database default menu bar and figured out that the menu item that selects a window is of type 1, and id 830, the caption of the menu item (control) is &# Window Name

On the customized db I used the:

Expand|Select|Wrap|Line Numbers
  1.    Set cbcCutomMenuButton = cbcCutomMenu.Controls.Add(1,830)
  2.    With cbcCutomMenuButton
  3.     .Caption = "&1 Main Menu"
  4.    End With
  5.  
If I try to set the id as 830 it yields an Add method error, If i don't, it doesn't do nothing upon clicking it.

If I generated a new application toolbar, I should be adding, for each form that is opened, a menu item into the drop down menu Window in the onopen event of the form?, with the control's onaction property set to focus the form, and on the onclose event to the form i should remove the menu item?

Is there any way to emulate the default toolbar behaviour?

Please advise, note that manually adding a menu item is not possible due to technical reasons (and because since I've been going at this thing for 3 hours without luck, and also because of my curiosity if this can be done :))

Thanks in advance and best regards,

Afro
Dec 11 '09 #1
2 1772
ADezii
8,834 Recognized Expert Expert
Why not Hide the Original Custom Command Bar, Clone it whenever appropriate along with its Controls, then make it Visible, positioning it at the Top of the Window. All 'Opened' Windows will then be Visible in the Drop Down Window Menu. I executed this code against the Northwind Custom Menu Bar in the Sample Database and, although it is a rather rogue solution, it does work. Simply create a Function encapsulating the code, then call it whenever needed. I'm not really sure that this can be done in any other fashion. Good Luck.
Expand|Select|Wrap|Line Numbers
  1. Dim mbr As CommandBar
  2. Dim cbrCopy As CommandBar
  3. Dim cbr As CommandBarControl
  4. Dim ctl As CommandBarControl
  5. Dim cbrCtl As CommandBarControl
  6. Dim intOrigCount As Integer
  7.  
  8. 'Customize with your own Name
  9. Const strCLONE_TBR_NAME As String = "Window_2"
  10.  
  11. Application.CommandBars("NorthwindCustomMenuBar").Visible = False
  12.  
  13. Set mbr = CommandBars("NorthwindCustomMenuBar")
  14. Set cbr = mbr.Controls("Window")
  15.  
  16. 'DELETE if it exists to avoid ERROR
  17. Application.CommandBars(strCLONE_TBR_NAME).Delete
  18.  
  19. 'Count of Controls on Original Command Bar
  20. intOrigCount = mbr.Controls.Count
  21.  
  22. 'ADD the New Command Bar to the Collection, make Visible
  23. Set cbrCopy = CommandBars.Add(strCLONE_TBR_NAME)
  24.     cbrCopy.Visible = True
  25.  
  26. 'Copy all Controls to the Cloned Command Bar
  27. For Each cbrCtl In mbr.Controls
  28.   cbrCtl.Copy cbrCopy
  29. Next cbrCtl
  30.  
  31. 'Position at Top of Window
  32. cbrCopy.Position = msoBarTop
Dec 11 '09 #2
afromanam
22 New Member
Hi

Thanks for the reply, will look into that.

Unfortunately my weekend didn't unfold as planned so I couldn't test this at home. I managed to write a couple of sub's which add the window name to the custom window menu on the onopen event, with the onaction property set to a generic fnFocusForm(frm name), and remove the button from the custom Window Menu it on the onclose event.

Feels like I'll have even more control over what the users are seeing.

I will try your approach later, I'd just have to loop thru the default Window Menu Window Selectors (that's what I call 'em, don't know if that's their right name) to see if I want the user to see that particular window.

Regards,

Afro
Dec 14 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
15750
by: George Hester | last post by:
I have a css file this is a portion of it: /* trackaccept.css */ div.track { width:400px; height: 100px; } I have this in my ASP page:
23
2694
by: JustMe | last post by:
I don't know if this has anything to do with AccessXP running on Terminal Services with Access97/2000 also installed, but here is one example of a query that does not work any longer: SELECT DLookUp("MajorCategory","AutoTypes","='1'") AS MajorCategory, PreOwned.PaintColor FROM PreOwned; When I try to run the above query I get the following error:
2
3942
by: BT Openworld | last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject) doesn't work when loaded on Windows XP. I'm finding my way around Access 2003 but my biggest problem is getting information. When I bought Access 1.0 many years ago, I got a paper manual and an excellent help file with all you needed to know. With Access 97 the manual came as a 'Building Applications' document on the CD and I still had the excellent help. With Access...
6
4753
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
2
2198
by: Alicia | last post by:
If I wanted to create a table by hand create table temp( etc, where do I do it in access?
3
6205
by: Robin | last post by:
Hi all, I'm working with a VB app, using DAO 3.6, that used to generate Access '97 databases using the following code: Set dbsNew = wrkDefault.CreateDatabase(strLPAccessInv, dbLangGeneral, dbVersion30) I was able to have it create databases in Access 2000 by changing "dbVersion30" to "dbVersion40". Do I generate a database in Access
1
14047
by: Joe | last post by:
I have a table with a student id and course id. I would like to make both fields the primary key since a student can have multiple course ids but I do not want duplicate records. How would I go about creating the multiple field PK in Access 2003? Thanks!
5
2690
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
1
1639
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im facing a problem in opening some forms from command button a message appear the openform action was canceled and when i open them from the database window(form) there are problem in open event or change event or activate event the same file is work...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.