Combo box range selection (1 Viewer)

ganjaloco

New member
Local time
Today, 04:09
Joined
Dec 12, 2014
Messages
4
Access 2007
Inside main form f_order
I have a subform f_filter_nycklar
with only one column [Serie nr].
A list of unique serial numbers.
10001B
10002B
10003B
... to
99999B

The subform is based on q_filter_nycklar which in turn is based on tbl_filter_nycklar

I have two unbound combo boxes both based on tbl_filter_nycklar
I want chose starting number [ex 14001B], and end number (ex 14050B) and the subform to filter all numbers from first to last based on that selection.

I later want to copy this selection and past append into another subform on the same main form.

I have tried to set condition in q_filter_nycklar
>=[Forms]![f_filter_nycklar]![F] Or <=[Forms]![f_filter_nycklar]![T]
It does not work

With condition blank the combo boxes list all available numbers and the subform continuously lists all numbers
With condition the combo boxes list all available numbers but subform is blank no matter what I chose in the combo boxes (including leaving blank)

How to solve this?
 

Never Hide

Registered User.
Local time
Today, 14:09
Joined
Dec 22, 2011
Messages
96
I guess that in the record source of the f_filter_nycklar you've use the combo box values as conditions to display the data.

If that is the case I suggest a different approach.
Set the record source of f_filter_nycklar without any condition so it'll get all the data.
Place the following code in the after update of one of the combo boxes
Code:
Dim strFilter As String

strFilter = "[Serie nr] BETWEEN " & Me.F & " AND " & Me.T
Me.f_filter_nycklar.Form.FilterOn = False
Me.f_filter_nycklar.Form.Filter = strFilter
Me.f_filter_nycklar.Form.FilterOn = True

So lets say you put this code in the after update of "F", go to the after update of "T" and call F_AfterUpdate
 

ganjaloco

New member
Local time
Today, 04:09
Joined
Dec 12, 2014
Messages
4
Cheers for the reply. I tried that. The combo box still will not sort out the values.
Whatever I enter in the two combo boxes the list rows remain intact and the same. All of them listed.
 

ganjaloco

New member
Local time
Today, 04:09
Joined
Dec 12, 2014
Messages
4
This [Evenet Procedure] is now in the code on the After Update for Combo Box F which is in the f_filter-nycklar subform.

Private Sub F_AfterUpdate()
Dim strFilter As String
strFilter = "[Serie nr] BETWEEN " & Me.F & " AND " & Me.T
Me.f_filter_nycklar.Form.FilterOn = False
Me.f_filter_nycklar.Form.Filter = strFilter
Me.f_filter_nycklar.Form.FilterOn = True
End Sub

When I save and try to pick a value from the combo box it says:
Compile error: Method or data member not found, pointing to the .f_filter_nycklar in the fourth row.

I know little about VBA. How do I call F_AfterUpdate in the after update for T? What do I write there?
 

Users who are viewing this thread

Top Bottom