remove filtering problem

  • Thread starter Thread starter Masoud
  • Start date Start date
M

Masoud

Hello, I have main form, when i clicked on the each button it will execute
the code as below and open another form (frmisometricA/G) with the filtering
like below. Now i want that nobody can remove filter on the opened form and
just possible filtering more on the opened form and when they remove filter
it shows the records like when at fist will be open not all the records. My
query for opened form is like below.

My code:
Private Sub Ctl100_Click()
Dim strfilter As String
strfilter = Me.ActiveControl.Name
DoCmd.OpenForm "frmisometricA/G", 3, , "[UNIT No] LIKE '" &
Me.ActiveControl.Name & "*'"
DoCmd.Maximize
End Sub
------------------------------------------------------------------------------
My query for opened form "frmisometricA/G";
SELECT DISTINCTROW qryisometricfilename.hypersort,
qryisometricfilename.hyper, qryisometricfilename.[Unit No],
qryisometricfilename.[Line Size], qryisometricfilename.[Fluid Code],
qryisometricfilename.[Unit No Iso], qryisometricfilename.[Pipe Sequence No],
qryisometricfilename.[Piping Class], qryisometricfilename.[Insulation Code],
qryisometricfilename.[Total Sheet No], qryisometricfilename.[Issue Date],
qryisometricfilename.[MaxOfIsometric Drawing Rev],
qryisometricfilename.[MaxOfIsometric Drawing List Rev],
qryisometricfilename.[Issued For], qryisometricfilename.Remark,
qryisometricfilename.[DOC No], qryisometricfilename.[line No]
FROM qryisometricfilename
WHERE (((qryisometricfilename.[DOC No]) Like "*001" Or
(qryisometricfilename.[DOC No]) Like "*003"))
ORDER BY qryisometricfilename.hypersort, qryisometricfilename.hyper,
qryisometricfilename.[Unit No], qryisometricfilename.[Line Size],
qryisometricfilename.[Fluid Code], qryisometricfilename.[Unit No Iso],
qryisometricfilename.[Pipe Sequence No], qryisometricfilename.[Piping Class],
qryisometricfilename.[Insulation Code];
Thanks in advanced.
 
Hi, I copied and paste the code in the ApplyFilter event but it does not
work, because when i removed the filter it shows all the records. As i wrote
before my form open filtered in datasheet view by ([UNIT No] LIKE '100*'), i
want possible more filtering in this view and when i remove filter it shows
records filtered by ([UNIT No] LIKE '100*'), any way i checked alot your code
for example i change like this so it cancelled every filter (filter by
selection, remove filter), please help what is the problem.
Best regards.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Cancel = True
End If
End Sub


Alex Dybenko said:
Hi,
you can use ApplyFilter event to cancel filter remove:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 0 Then
Cancel = True
End If
End Sub

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hello, I have main form, when i clicked on the each button it will execute
the code as below and open another form (frmisometricA/G) with the
filtering
like below. Now i want that nobody can remove filter on the opened form
and
just possible filtering more on the opened form and when they remove
filter
it shows the records like when at fist will be open not all the records.
My
query for opened form is like below.

My code:
Private Sub Ctl100_Click()
Dim strfilter As String
strfilter = Me.ActiveControl.Name
DoCmd.OpenForm "frmisometricA/G", 3, , "[UNIT No] LIKE '" &
Me.ActiveControl.Name & "*'"
DoCmd.Maximize
End Sub
------------------------------------------------------------------------------
My query for opened form "frmisometricA/G";
SELECT DISTINCTROW qryisometricfilename.hypersort,
qryisometricfilename.hyper, qryisometricfilename.[Unit No],
qryisometricfilename.[Line Size], qryisometricfilename.[Fluid Code],
qryisometricfilename.[Unit No Iso], qryisometricfilename.[Pipe Sequence
No],
qryisometricfilename.[Piping Class], qryisometricfilename.[Insulation
Code],
qryisometricfilename.[Total Sheet No], qryisometricfilename.[Issue Date],
qryisometricfilename.[MaxOfIsometric Drawing Rev],
qryisometricfilename.[MaxOfIsometric Drawing List Rev],
qryisometricfilename.[Issued For], qryisometricfilename.Remark,
qryisometricfilename.[DOC No], qryisometricfilename.[line No]
FROM qryisometricfilename
WHERE (((qryisometricfilename.[DOC No]) Like "*001" Or
(qryisometricfilename.[DOC No]) Like "*003"))
ORDER BY qryisometricfilename.hypersort, qryisometricfilename.hyper,
qryisometricfilename.[Unit No], qryisometricfilename.[Line Size],
qryisometricfilename.[Fluid Code], qryisometricfilename.[Unit No Iso],
qryisometricfilename.[Pipe Sequence No], qryisometricfilename.[Piping
Class],
qryisometricfilename.[Insulation Code];
Thanks in advanced.
.
 
Hi,
you have to use
If ApplyType = 0 Then
Cancel = True
End If

0 means remove filter, so code cancels remove filter event

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hi, I copied and paste the code in the ApplyFilter event but it does not
work, because when i removed the filter it shows all the records. As i
wrote
before my form open filtered in datasheet view by ([UNIT No] LIKE '100*'),
i
want possible more filtering in this view and when i remove filter it
shows
records filtered by ([UNIT No] LIKE '100*'), any way i checked alot your
code
for example i change like this so it cancelled every filter (filter by
selection, remove filter), please help what is the problem.
Best regards.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Cancel = True
End If
End Sub


Alex Dybenko said:
Hi,
you can use ApplyFilter event to cancel filter remove:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 0 Then
Cancel = True
End If
End Sub

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hello, I have main form, when i clicked on the each button it will
execute
the code as below and open another form (frmisometricA/G) with the
filtering
like below. Now i want that nobody can remove filter on the opened form
and
just possible filtering more on the opened form and when they remove
filter
it shows the records like when at fist will be open not all the
records.
My
query for opened form is like below.

My code:
Private Sub Ctl100_Click()
Dim strfilter As String
strfilter = Me.ActiveControl.Name
DoCmd.OpenForm "frmisometricA/G", 3, , "[UNIT No] LIKE '" &
Me.ActiveControl.Name & "*'"
DoCmd.Maximize
End Sub
------------------------------------------------------------------------------
My query for opened form "frmisometricA/G";
SELECT DISTINCTROW qryisometricfilename.hypersort,
qryisometricfilename.hyper, qryisometricfilename.[Unit No],
qryisometricfilename.[Line Size], qryisometricfilename.[Fluid Code],
qryisometricfilename.[Unit No Iso], qryisometricfilename.[Pipe Sequence
No],
qryisometricfilename.[Piping Class], qryisometricfilename.[Insulation
Code],
qryisometricfilename.[Total Sheet No], qryisometricfilename.[Issue
Date],
qryisometricfilename.[MaxOfIsometric Drawing Rev],
qryisometricfilename.[MaxOfIsometric Drawing List Rev],
qryisometricfilename.[Issued For], qryisometricfilename.Remark,
qryisometricfilename.[DOC No], qryisometricfilename.[line No]
FROM qryisometricfilename
WHERE (((qryisometricfilename.[DOC No]) Like "*001" Or
(qryisometricfilename.[DOC No]) Like "*003"))
ORDER BY qryisometricfilename.hypersort, qryisometricfilename.hyper,
qryisometricfilename.[Unit No], qryisometricfilename.[Line Size],
qryisometricfilename.[Fluid Code], qryisometricfilename.[Unit No Iso],
qryisometricfilename.[Pipe Sequence No], qryisometricfilename.[Piping
Class],
qryisometricfilename.[Insulation Code];
Thanks in advanced.
.
 
Hi,thanks, it does not work; also I put this code (msgbox applytype) in
applyfilter event, so the value of applytype always is "1", in remove filter
and filter by selection. I do not know why the value of applytype in my form
always is "1" so your code does not work for me. How I can solve this problem?

Thanks in advanced.


Alex Dybenko said:
Hi,
you have to use
If ApplyType = 0 Then
Cancel = True
End If

0 means remove filter, so code cancels remove filter event

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hi, I copied and paste the code in the ApplyFilter event but it does not
work, because when i removed the filter it shows all the records. As i
wrote
before my form open filtered in datasheet view by ([UNIT No] LIKE '100*'),
i
want possible more filtering in this view and when i remove filter it
shows
records filtered by ([UNIT No] LIKE '100*'), any way i checked alot your
code
for example i change like this so it cancelled every filter (filter by
selection, remove filter), please help what is the problem.
Best regards.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Cancel = True
End If
End Sub


Alex Dybenko said:
Hi,
you can use ApplyFilter event to cancel filter remove:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 0 Then
Cancel = True
End If
End Sub

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Hello, I have main form, when i clicked on the each button it will
execute
the code as below and open another form (frmisometricA/G) with the
filtering
like below. Now i want that nobody can remove filter on the opened form
and
just possible filtering more on the opened form and when they remove
filter
it shows the records like when at fist will be open not all the
records.
My
query for opened form is like below.

My code:
Private Sub Ctl100_Click()
Dim strfilter As String
strfilter = Me.ActiveControl.Name
DoCmd.OpenForm "frmisometricA/G", 3, , "[UNIT No] LIKE '" &
Me.ActiveControl.Name & "*'"
DoCmd.Maximize
End Sub
------------------------------------------------------------------------------
My query for opened form "frmisometricA/G";
SELECT DISTINCTROW qryisometricfilename.hypersort,
qryisometricfilename.hyper, qryisometricfilename.[Unit No],
qryisometricfilename.[Line Size], qryisometricfilename.[Fluid Code],
qryisometricfilename.[Unit No Iso], qryisometricfilename.[Pipe Sequence
No],
qryisometricfilename.[Piping Class], qryisometricfilename.[Insulation
Code],
qryisometricfilename.[Total Sheet No], qryisometricfilename.[Issue
Date],
qryisometricfilename.[MaxOfIsometric Drawing Rev],
qryisometricfilename.[MaxOfIsometric Drawing List Rev],
qryisometricfilename.[Issued For], qryisometricfilename.Remark,
qryisometricfilename.[DOC No], qryisometricfilename.[line No]
FROM qryisometricfilename
WHERE (((qryisometricfilename.[DOC No]) Like "*001" Or
(qryisometricfilename.[DOC No]) Like "*003"))
ORDER BY qryisometricfilename.hypersort, qryisometricfilename.hyper,
qryisometricfilename.[Unit No], qryisometricfilename.[Line Size],
qryisometricfilename.[Fluid Code], qryisometricfilename.[Unit No Iso],
qryisometricfilename.[Pipe Sequence No], qryisometricfilename.[Piping
Class],
qryisometricfilename.[Insulation Code];
Thanks in advanced.

.
.
 
Hi,
in my case - when I run filter by selection ApplyType =1, and when I remove
filter ApplyType =0

try to run this code on a new simple form

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hi,thanks, it does not work; also I put this code (msgbox applytype) in
applyfilter event, so the value of applytype always is "1", in remove
filter
and filter by selection. I do not know why the value of applytype in my
form
always is "1" so your code does not work for me. How I can solve this
problem?

Thanks in advanced.


Alex Dybenko said:
Hi,
you have to use
If ApplyType = 0 Then
Cancel = True
End If

0 means remove filter, so code cancels remove filter event

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Masoud said:
Hi, I copied and paste the code in the ApplyFilter event but it does
not
work, because when i removed the filter it shows all the records. As i
wrote
before my form open filtered in datasheet view by ([UNIT No] LIKE
'100*'),
i
want possible more filtering in this view and when i remove filter it
shows
records filtered by ([UNIT No] LIKE '100*'), any way i checked alot
your
code
for example i change like this so it cancelled every filter (filter by
selection, remove filter), please help what is the problem.
Best regards.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Cancel = True
End If
End Sub


:

Hi,
you can use ApplyFilter event to cancel filter remove:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 0 Then
Cancel = True
End If
End Sub

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


Hello, I have main form, when i clicked on the each button it will
execute
the code as below and open another form (frmisometricA/G) with the
filtering
like below. Now i want that nobody can remove filter on the opened
form
and
just possible filtering more on the opened form and when they remove
filter
it shows the records like when at fist will be open not all the
records.
My
query for opened form is like below.

My code:
Private Sub Ctl100_Click()
Dim strfilter As String
strfilter = Me.ActiveControl.Name
DoCmd.OpenForm "frmisometricA/G", 3, , "[UNIT No] LIKE '" &
Me.ActiveControl.Name & "*'"
DoCmd.Maximize
End Sub
------------------------------------------------------------------------------
My query for opened form "frmisometricA/G";
SELECT DISTINCTROW qryisometricfilename.hypersort,
qryisometricfilename.hyper, qryisometricfilename.[Unit No],
qryisometricfilename.[Line Size], qryisometricfilename.[Fluid Code],
qryisometricfilename.[Unit No Iso], qryisometricfilename.[Pipe
Sequence
No],
qryisometricfilename.[Piping Class],
qryisometricfilename.[Insulation
Code],
qryisometricfilename.[Total Sheet No], qryisometricfilename.[Issue
Date],
qryisometricfilename.[MaxOfIsometric Drawing Rev],
qryisometricfilename.[MaxOfIsometric Drawing List Rev],
qryisometricfilename.[Issued For], qryisometricfilename.Remark,
qryisometricfilename.[DOC No], qryisometricfilename.[line No]
FROM qryisometricfilename
WHERE (((qryisometricfilename.[DOC No]) Like "*001" Or
(qryisometricfilename.[DOC No]) Like "*003"))
ORDER BY qryisometricfilename.hypersort, qryisometricfilename.hyper,
qryisometricfilename.[Unit No], qryisometricfilename.[Line Size],
qryisometricfilename.[Fluid Code], qryisometricfilename.[Unit No
Iso],
qryisometricfilename.[Pipe Sequence No],
qryisometricfilename.[Piping
Class],
qryisometricfilename.[Insulation Code];
Thanks in advanced.

.
.
 
Back
Top