Re: Access module does not continue past the Filter Method



Add a Debug.Print to the top of the routine to ensure that is in fact
executing.

Then put a break point on the top Debug.Print line (by pressing F9.) When it
breaks, press F8 to single-step through the code, so you can see where it is
going.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dalbin" <dalbin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:43774251-A5D1-4C3E-82DA-DAF3B171C957@xxxxxxxxxxxxxxxx
Allen,

Thank you for your reply. I tried both of your suggestions, but neither
fixed my problem. I did verify that the "decompile" switch did decompile
my
program. I also added the "Dirty" code, but this problem appears even
when
the record is not "Dirty".

Nonetheless, I had not thought of either of your suggestions, and I
appreciate your help. Please let me know if you have any other
suggestions.

"Allen Browne" wrote:

Decompile a copy of the database by entering something like this at the
command prompt while Access is not running. It is all one line, and
include
the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"
Then compact the database.

You have not actully set the FilterOn property. Additionally, it may not
work as expected if the form is dirty with a record that cannot be saved
(e.g. required field missing, or validation rule not met.)

Try something like this:
Public Sub Apply_Tech_Filter()
With Forms![Technical Form]
If .Dirty Then .Dirty = False
.Filter = "RequestType = 1"
.FilterOn = True
End With
Debug.Print "Past the Filter"
End Sub

(We are assuming that RequestType is a Number type field.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dalbin" <dalbin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F32C47F1-345F-4613-A0EE-14BB5F4AB570@xxxxxxxxxxxxxxxx
I have a subroutine in an Access Module that creates and applies a
filter.
When I call the subroutine, it does apply the filter, giving no error
messages. But, the program stops after the filter is applied. It does
not
continue to process subsequent commands. Please provide any insight
into
why
this is happening.

The code is:

Public Sub Apply_Tech_Filter()
Dim RequestType As Integer
Request_Type = 1
Forms![Technical Form].Filter = "RequestType = " & Request_Type
Debug.Print "Past the Filter"
End Sub

PROBLEM: It does not proceed to the "Debug.Print" Line.
NOTE: RequestType is a field on the "Technical Form" Form.





.



Relevant Pages

  • Re: Sending report about the current record in mail
    ... You can save the record by setting Dirty to False. ... >> filter so the report opens and is sent with just the record you need. ... Private Sub Report_Open ...
    (microsoft.public.access.forms)
  • Re: Access module does not continue past the Filter Method
    ... I figured out the "AllowBreakIntoCode" Problem. ... Allen Browne - Microsoft MVP. ... I also added the "Dirty" code, ... Debug.Print "Past the Filter" ...
    (microsoft.public.access.modulesdaovba)
  • Re: Access module does not continue past the Filter Method
    ... I did verify that the "decompile" switch did decompile my ... work as expected if the form is dirty with a record that cannot be saved ... Debug.Print "Past the Filter" ... Dim RequestType As Integer ...
    (microsoft.public.access.modulesdaovba)
  • Re: Oh Crapp
    ... The wrench also showed him how dirty the intake was apparently, ... mile long dirt road so there should be signs of more dirt in the filter ... He took it to a local wrench who is HD certified with a complete machine ...
    (rec.motorcycles.harley)
  • Re: heat pump question
    ... then you might have done damage to the compressor. ... A dirty air filter ...
    (alt.home.repair)