Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comboBox on Office Ribbon

Status
Not open for further replies.

BradCollins

Technical User
Sep 2, 2003
116
AU
Does anyone have any idea where I have gone wrong in trying to put a combox on a custom ribbon. I just cannot get this to work.

The XML that I have appears to be fine. It is:

Code:
<comboBox id="cmbShowJobs" label = "Filter By" onChange="mcrFilterJobs.CurrentJobs">
	<item id="All"  label="Show All"/>
	<item id="Mine"  label="My Jobs"/>
	<item id="High"  label="High Priority Jobs"/>
	<item id="Critical"  label="Critical Jobs"/>
	<item id="Medium"  label="Medium Priority Jobs"/>
	<item id="Low"  label="Low Priority Jobs"/>
</comboBox>
I then created the macro 'mcrFilterJobs'

Within that macro is the macro name 'CurrentJobs' which has the following attributes :

Action : RunCode
Arguments : FilterCurrent()

Then I have created the code as shown below in a module:

Code:
Public Function FilterCurrent(control As IRibbonControl, selectedId As String)

Dim varCurrentUser As Variant

varCurrentUser = DLookup("fldLoginID", "tblcurrentuser")

Select Case control.ID

    Case "cmbShowJobs"

If selectedId = "High Jobs" Then
    Forms!frmMain.Filter = "fldPriority = 'High'"
    Forms!frmMain.FilterOn = True
    ElseIf selectedId = "Critical Jobs" Then
        Forms!frmMain.Filter = "fldPriority = 'Critical'"
        Forms!frmMain.FilterOn = True
        ElseIf selectedId = "Medium Jobs" Then
            Forms!frmMain.Filter = "fldPriority = 'Medium'"
            Forms!frmMain.FilterOn = True
            ElseIf selectedId = "Low Jobs" Then
                Forms!frmMain.Filter = "fldPriority = 'Low'"
                Forms!frmMain.FilterOn = True
                ElseIf selectedId = "My Jobs" Then
                    Forms!frmMain.Filter = "fldAssignedID = " & varCurrentUser
                    Forms!frmMain.FilterOn = True
                    ElseIf selectedId = "Show All" Then
                        Forms!frmMain.FilterOn = False
                 
End If

End Select

End Function
I am sure it is this code that is wrong, but how do I correctly reference the combobox I have created and then perform the filter based on the selection.

As always your help and advice is most appreciated.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top