Command bar properties

arage

Registered User.
Local time
Today, 19:48
Joined
Dec 30, 2000
Messages
537
Command bar properties
I created my command bar objects & set their ONACTION property in code but noticed that it is not populating with the function name I specified. Isn’t it supposed to?

Here’s what the offending code looks like :D

'places items onto the "Filter Toolbar"...
Public Function createToolbar()
Dim runButton As CommandBarControl
'a button to run an object...
Set runButton = CommandBars("Filter Toolbar").Controls _
.Add(Type:=msoControlButton)
With runButton
.caption = "&Run"
.Style = msoButtonCaption
.OnAction = buildSQL()
End With
End Function
 
For the mean time I have fixed the problem by using a macro instead of a function, seems to have fixed the problem, but now something else has cropped up.

The macro is supposed to place the report in design view & then preview view again, to refresh the data based upon certain criteria I placed in code. Now while the report is going from design view to report view, the results are not changing they’re staying the same! Please advise.

Here’s the filter criteria I am applying as well as the reformatted ONACTION property above.

'places items onto the "Filter Toolbar"...
Public Function createToolbar()
Dim runButton As CommandBarControl
'a button to run an object...
Set runButton = CommandBars("Filter Toolbar").Controls _
.Add(Type:=msoControlButton)
With runButton
.caption = "&Run"
.Style = msoButtonCaption
.OnAction = “mcrBuildSQL”
End With
End Function

'changes recordsource & runs appropriate obj...
Function buildSQL()
Select Case objName
Case "rptJunk"
strSQL = "PromotionType='BE'"
DoCmd.OpenReport objName, acViewDesign
DoCmd.OpenReport objName, acViewPreview, , strSQL
End Select
End Function
 

Users who are viewing this thread

Back
Top Bottom