'Code By Mark Phillips
'CafeCartel.com
'Instructions:
'Copy all of this code into a Module. To Run:
'Type CreateTestBar into your immideate window.
'Go back to the Access Shell to view the results
'Ever want to find a Icon that isn't listed
'when you are creating or editing a toolbar?
'I have, so I wrote this.
'The first function creates
'a toolbar that lists all of the possible icons
'that might be listed. They are indexed by number, i don't
'know how many there are, but I ran the check
'up to 5100.
'The second function is from a microsoft
'helpfile that checks to see if the db has a
'toolbar of the same name that you are creating.
'If there is a toolbar with the same name, it deletes it.
'I used a name that I don't think anyone will have.
'After you run the code. Go back to the access
'window and you will have a toolbar that lists
'numbers 1 to 100. Click on the first one and
'you will get a list of 1 to 50 that shows all
'the icons and their id. The same goes for the
'rest of the list.
You will first need to add a reference to your Access Database. In the code window goto tools-->References then scroll down the list and selectthe Microsoft Office XX.X Object Library. Where XX is the version number of your access database.
Public Function CreateTestBar()
Dim i As Integer
Dim x As Integer
Dim y As Integer
'i the popmenus
'x is the buttons
x = 1
i = 1
y = 1
strMenuName = "ButtonTest40833" 'Make sure you don't have a button named "ButtonTest40833", this function would delete it.
If fIsCreated(strMenuName) Then
Application.CommandBars(strMenuName).delete
End If
Set cmdNewMenu = Application.CommandBars.Add(strMenuName, msoBarTop, True, False)
For i = 1 To 100
Set cctlSubMenu = cmdNewMenu.Controls.Add(Type:=10)
With cctlSubMenu
.Caption = i
.BeginGroup = True
End With
y = x + 50
For x = x To

Set CBarCtl = cctlSubMenu.Controls.Add(Type:=msoControlButton)
With CBarCtl
.Caption = Chr(34) & x & Chr(34)
.FaceId = x
End With
Next
Next
cmdNewMenu.Visible = True
End Function
Function fIsCreated(strMenuName) As Boolean
Dim intNumberMenus As Integer
Dim i As Integer
intNumberMenus = Application.CommandBars.Count
fIsCreated = False
For i = 1 To intNumberMenus
If Application.CommandBars(i).Name = strMenuName Then
fIsCreated = True
i = intNumberMenus
End If
Next
End Function