Custom toolbar

  • Thread starter Thread starter Gerry
  • Start date Start date
G

Gerry

I created a custom toolbar in Access XP and have recently upraded to Access
2007. The custom toolbar is now found in the add-ins tab. However, I would
like to be able to move the custom toolbar so that it can be positioned
anywhere on the screen. Is this possible?

Thanks,

Gerry
 
Gerry,

Check out the thread "Does anyone understand toolbars" in the Access
Database Forms newsgroup. I've started creating my toolbars (popup) in code
rather than using the View - Toolbars - Customize menu option. I find this
to be more flexible, and portable than the other methods. Once you have a
toolbar, menu, or shortcut menu created with code, you can display it any
time you want, and if it is a popup, you can actually position it where you
want using the "ShowPopup" method of the CommandBars object. Sample code
follows:


Const BarPopup = 5
Const ControlButton = 1
Const ControlEdit = 2
Const ControlComboBox = 4
Const ButtonUp = 0
Const ButtonDown = -1

Public Sub ReportMenu()

Dim cbr As Object
Dim cbrButton As Object
Dim strSQL As String
Dim rs As DAO.Recordset

On Error Resume Next
CommandBars("MyReportMenu").Delete
On Error GoTo ReportMenuError

Set cbr = CommandBars.Add("MyReportMenu", BarPopup, , True)

With cbr

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&Print"
.Tag = "Print"
.OnAction = "=fnPrintReport()"
End With

Set cbrButton = cbr.Controls.Add(ControlButton, , , , True)
With cbrButton
.Caption = "&Close"
.Tag = "Close"
.OnAction = "=fnCloseReport()"
End With

End With

Exit Sub
ReportMenuError:
MsgBox "ReportMenu error" & vbCrLf
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top