If you actually meant a ComboBox in a CommandBar in your application, then I
*think* you need to add the Office Object Library to the References and use
fully-qualified references to the CommandBars. Probably, it should be:
Application.CommandBars("CmdBarName").Controls("CmdBarComboName").....
--
HTH
Van T. Dinh
MVP (Access)
Quote:
> Sub/Function not defined
> I'm trying to user the enclosed function to build my
> report's filter criteria but as per below, the
> COMMANDBARCOMBOBOX statement keeps stopping with the error
> message that the "Sub or Function is not defined." Any
> help would be appreciated.
> 'determines WHERE criteria to apply to a report.
> Function buildSQL()
> strSQL = "PromotionType= " & Choose(CommandBarComboBox
> (filterType).ListIndex, "BE", "OA") & " and year
> (mediaStartDate) like filteryear"
> DoCmd.OpenReport objName, acViewPreview, , strSQL
> End Function