overlapping filter subform (1 Viewer)

benjamin.weizmann

Registered User.
Local time
Today, 10:24
Joined
Aug 30, 2016
Messages
78
hi :)
I do have some event

event 1 -> filter on condition #1 in addition to what already exists
t_event1 -> cancel event 1, but stay the other filters
event 2 -> filter on condition #2 in addition to what already exists
t_event1 -> cancel event 2, but leave the other filter

on subform I would like to run any combination according to user chose- for example:

event 1-> event2 ->t_event2 ->t_event1
event2->event1->t_event1 -> t_event2
........

how can I do this overlapping filter ??

thanks!!
Ben
 

isladogs

MVP / VIP
Local time
Today, 18:24
Joined
Jan 14, 2017
Messages
18,282
Ben

This doesn't answer your question but is an observation...

You seem to be posting numerous questions with a scattergun like approach at the moment.
Lots of people have replied to these messages with detailed advice, including myself on several occasions.

However you rarely seem to respond to advice given or close the thread stating what your solution was.

Please read this 'sticky' post I wrote a few days ago ...
https://www.access-programmers.co.uk/forums/showpost.php?p=1552924&postcount=1
 

benjamin.weizmann

Registered User.
Local time
Today, 10:24
Joined
Aug 30, 2016
Messages
78
hi :)
when I success you close the answer
please follow it,
in addition I do thanks for all who replied to me!
about the number of the questions : I do one-time project
I started fro, zero knowledge and in 1 month I built very complex software
of course with contribution any one of you
.. so when I finish it (and yes.. I have a deadline ) will not seen I post any question.
i'm sorry to hear it's your impression

Ben
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:24
Joined
May 7, 2009
Messages
19,249
on the Form's Module, add two module-wise variables:

Option Compare Database
Option Explicit

Dim mdl_StrFilter1 As String
Dim mdl_StrFilter2 As String

1. new or appending filter:

on any event that creates the filter (whether through click of button or Update event of combobox), set the values of these strings:

mdl_StrFilter1="[somefield]=" & chr(34) & me.combo & chr(34)

Call add_filter(mdl_StrFilter1)


2. on event that removes the filter

Call remove_fix_filter(mdl_StrFilter1)


******

Private Sub add_filter(strAddFilter As String)
Dim strFilter As String
strFilter = Trim(Me.Filter & "")
If Len(strFilter)<>0 Then
strFilter = strFilter & " And " & strAddFilter
Else
strFilter = strAddFilter
End If
Me.Filter = strFilter
Me.FilterOn=True
End Sub


Private Sub remove_fix_filter(strRemoveFilter As String)
Dim strFilter As String
strFilter = Trim(Me.Filter & "")
If Len(strFilter)<>0 Then
'remove the filter
strFilter = Replace(strFilter, strRemoveFilter, "")
strFilter = Trim(strFilter)
'if there is leading "And" or "Or" on the remnant string, remove it
If Instr(strFilter, "And")=1 Then strFilter = Mid(strFilter,4)
strFilter = Trim(strFilter)
If Instr(strFilter, "Or")=1 Then strFilter = Mid(strFilter,3)
strFilter = Trim(strFilter)
'if there is trailing "And" or "Or" on the remnant string, remove it
If InstrRev(strFilter, "And")=Len(strFilter)-3 Then strFilter = Left(strFilter,Len(strFilter)-3)
strFilter = Trim(strFilter)
If InstrRev(strFilter, "Or")=Len(strFilter)-2 Then strFilter = Left(strFilter,Len(strFilter)-2)
strFilter = Trim(strFilter)
End If
Me.Filter = strFilter
Me.FilterOn=True
End Sub


!! wasn't able to test this, so basically this will be a template of what you need to do
 

isladogs

MVP / VIP
Local time
Today, 18:24
Joined
Jan 14, 2017
Messages
18,282
hi :)
when I success you close the answer
please follow it,
in addition I do thanks for all who replied to me!
about the number of the questions : I do one-time project
I started fro, zero knowledge and in 1 month I built very complex software
of course with contribution any one of you
.. so when I finish it (and yes.. I have a deadline ) will not seen I post any question.
i'm sorry to hear it's your impression

Ben

Hi Ben

Before I responded, I checked back to several other posts you had done.
Yes I agree you have thanked people in a lot of cases.

The main point in your case is that several threads have been opened & left unresolved.
Detailed advice was given with no further response or in some case no response by you...

You have just marked another thread as SOLVED - that's great.
Perhaps you could review other recent threads & update as appropriate.

Many thanks

Good luck with your project.
I hope you maker your deadline - you're certainly putting in the hours ...
 

Users who are viewing this thread

Top Bottom