You have the code handling this as :
- Private Sub cmbMinistryName_AfterUpdate()
-
Dim strFilter As String
-
With Me.SubForm.Form
-
' This assumes Handle is a text field
-
strFilter = "[MinName] Like '" & Me.cmbMinistryName & "*'"
-
.Filter = strFilter
-
.FilterOn = True
-
Call .Requery
-
End With
-
End Sub
You could have posted this instead of the whole database as an attachment and we could have got this quicker and easier.
The problem is your use of
Me.cmbMinistryName in line #5. You probably think the value will be a name ("MOE" or "MOH"), but it's actually just the [
minID] field, which is numeric.
Look at the design of
cmbMinistryName.
Column Count = 2 (minID & minName)
Column Widths = 0;2.54cm
Bound Column = 1
That last is the important one. That means the value of the ComboBox (when referred to as in Me.cmbMinistryName) is the
minID column. So, you get 1 instead of "MOH" & 15 instead of "MOE".
Try instead :
- Private Sub cmbMinistryName_AfterUpdate()
-
Dim strFilter As String
-
With Me.SubForm.Form
-
' This assumes Handle is a text field
-
strFilter = "[MinName] Like '" & Me.cmbMinistryName.Column(1) & "*'"
-
.Filter = strFilter
-
.FilterOn = True
-
'Following line not actually required after setting .Filter
-
'Call .Requery
-
End With
-
End Sub
Otherwise the code looks perfect.
Having seen the database of course, I can say I was impressed by the design and workings of it.