G
Gilbert 2097
Using Access 2003 - I have created a menu bar for a report which changes the
orderby property to view the report in different ways. I've created menus in
other app's so I've has 'some' experience. I would like to be able to use
this menu with other reports so I made it generic. The functions work fine
and DO change the order of the report, BUT the menu bar disappears when I
click any of the buttons so I can't change from one order to another without
closing the report and reopening it. I also remove the standard menubar and
make the buttons large size. Everything is working properly except that my
menu disappears when I click a button. In the close event I make the
standard menubar reappear and the buttons small again, and when I reopen the
report, the custom one reappears but as soon as I click on a button it
disappears again.
Am i overlooking something - I've searched the help but haven't had any
luck. I hope it's just a simple (stupid) mistake.
Code in standard module for menu called "Order By Options"
Public Function ByName() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Name"
CurrRep.OrderByOn = True
End Function
Public Function ByAmount() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Amount"
CurrRep.OrderByOn = True
End Function
Public Function ByLocation() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Location"
CurrRep.OrderByOn = True
End Function
Public Function ByDate() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "TransDate"
CurrRep.OrderByOn = True
End Function
Code in Report (w/ MenuBar property set to Order By Options)
Private Sub Report_Open(Cancel As Integer)
Dim AllBars As CommandBars
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
Set AllBars = CommandBars
AllBars.LargeButtons = True
End Sub
Private Sub Report_Close()
Dim AllBars As CommandBars
DoCmd.ShowToolbar "Order By Options", acToolbarNo
Set AllBars = CommandBars
AllBars.LargeButtons = False
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
End Sub
Any idea where to look?? Maybe someone can suggest a GOOD article on
menubars as I've read most of the 'Help' on it and sometimes it's confusing!?!
Thanx
orderby property to view the report in different ways. I've created menus in
other app's so I've has 'some' experience. I would like to be able to use
this menu with other reports so I made it generic. The functions work fine
and DO change the order of the report, BUT the menu bar disappears when I
click any of the buttons so I can't change from one order to another without
closing the report and reopening it. I also remove the standard menubar and
make the buttons large size. Everything is working properly except that my
menu disappears when I click a button. In the close event I make the
standard menubar reappear and the buttons small again, and when I reopen the
report, the custom one reappears but as soon as I click on a button it
disappears again.
Am i overlooking something - I've searched the help but haven't had any
luck. I hope it's just a simple (stupid) mistake.
Code in standard module for menu called "Order By Options"
Public Function ByName() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Name"
CurrRep.OrderByOn = True
End Function
Public Function ByAmount() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Amount"
CurrRep.OrderByOn = True
End Function
Public Function ByLocation() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "Location"
CurrRep.OrderByOn = True
End Function
Public Function ByDate() as variant
Dim CurrRep as Report
Set CurrRep = Screen.ActiveReport
CurrRep.OrderBy = "TransDate"
CurrRep.OrderByOn = True
End Function
Code in Report (w/ MenuBar property set to Order By Options)
Private Sub Report_Open(Cancel As Integer)
Dim AllBars As CommandBars
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
Set AllBars = CommandBars
AllBars.LargeButtons = True
End Sub
Private Sub Report_Close()
Dim AllBars As CommandBars
DoCmd.ShowToolbar "Order By Options", acToolbarNo
Set AllBars = CommandBars
AllBars.LargeButtons = False
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
End Sub
Any idea where to look?? Maybe someone can suggest a GOOD article on
menubars as I've read most of the 'Help' on it and sometimes it's confusing!?!
Thanx