I want to sort my form by the value populated from a combo box. Is it possible?
The combo box is storing a primary key # ([Parent_ID]) as the 1st column (hidden) and then showing the selected organization([Organization]).
Here's the current code. It's erroring on a missing operator "[Org_Child_ID]="
Org_Child_ID and Parent_ID as #. Organization is a string.
The combo box is storing a primary key # ([Parent_ID]) as the 1st column (hidden) and then showing the selected organization([Organization]).
Here's the current code. It's erroring on a missing operator "[Org_Child_ID]="
Org_Child_ID and Parent_ID as #. Organization is a string.
Code:
Private Sub Label4_Click()
Dim crid As String
crid = Nz(DLookup("[Organization]", "[t_Organization]", "[Org_Child_ID]=" & Me.Parent_ID), 0)
Me.OrderByOn = True
If Me.OrderBy = "crid ASC" Then
Me.OrderBy = "crid DESC"
Else
Me.OrderBy = "crid ASC"
End If
Me.Requery
End Sub