BradCollins
Technical User
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:
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:
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
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>
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
As always your help and advice is most appreciated.
Thanks