filterproblem

J

Jean-Paul

Hi,
In the filter-property of a form I write: [Alert]=true
(Alert is a yse/no field in my table)
The "allow filter" is set to "yes"
but there is no filtering.
What am I doing wrong?
Thanks
 
S

Steve Sanford

If you are in design view of a form and you enter "[Alert]=true" (without the
quotes), when you switch back to form view, you need to apply the filter.

In the tool bar there is a funnel. If you hold the cursor on the funnel, the
tooltip will say "Apply filter". Click on it to filter the form. Click on it
again to remove the filter.


HTH
 
J

Jean-Paul

Steve said:
If you are in design view of a form and you enter "[Alert]=true" (without the
quotes), when you switch back to form view, you need to apply the filter.

In the tool bar there is a funnel. If you hold the cursor on the funnel, the
tooltip will say "Apply filter". Click on it to filter the form. Click on it
again to remove the filter.


HTH
the filter doesn't work... all records are displayed as if no filter is
active.

JP
 
J

Jean-Paul

Steve said:
If you are in design view of a form and you enter "[Alert]=true" (without the
quotes), when you switch back to form view, you need to apply the filter.

In the tool bar there is a funnel. If you hold the cursor on the funnel, the
tooltip will say "Apply filter". Click on it to filter the form. Click on it
again to remove the filter.


HTH
Isn't there a way to apply the filter without having to click the funnel...
It works when I do so, but I want to automatically apply the filter upon
opening the corresponding form
Thanks
JP
 
S

Steve Sanford

OK, try this:

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Alert] = True"
End Sub

HTH
 
J

Jean-Paul

Steve said:
OK, try this:

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Alert] = True"
End Sub

HTH
It's that simply!!!! great, that's what I want...
Small question:
what is the difference between OnOpen and OnLoad?
Thnaks
JP
 
R

Rick Brandt

Jean-Paul said:
Steve said:
OK, try this:

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Alert] = True"
End Sub

HTH
It's that simply!!!! great, that's what I want...
Small question:
what is the difference between OnOpen and OnLoad?
Thnaks
JP

Open is first, Load is second. Certain data-centric things cannot be done
in Open because the recordset has not been "loaded" yet. Open can be
cancelled (to prevent the form from actually opening on the screen) while
Load cannot be.
 
J

Jean-Paul

Rick said:
Jean-Paul said:
Steve said:
OK, try this:

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Alert] = True"
End Sub

HTH
It's that simply!!!! great, that's what I want...
Small question:
what is the difference between OnOpen and OnLoad?
Thnaks
JP

Open is first, Load is second. Certain data-centric things cannot be done
in Open because the recordset has not been "loaded" yet. Open can be
cancelled (to prevent the form from actually opening on the screen) while
Load cannot be.

I still struggle with following situation....
When the form opens, I get the filtered records.
The Alert-field is displayed too.
Now I change the field to false... now the from should redisplay and the
record I just changed should be gone.
I tried me.refresh but... nothing

Sorry to bother you

JP
 
S

Steve Sanford

In the the control that is bound to the field "alert" is named "Alert", paste
in the following:


Private Sub Alert_AfterUpdate()
Dim msg As String

msg = "Are you sure you want to hide this record?"

If Me.alert = False Then
If MsgBox(msg, vbDefaultButton2 + vbYesNo) = vbYes Then
DoCmd.ApplyFilter , "[Alert]=True"
End If
End If
End Sub


I like to have a chance to change my mind. If you don't want the question,
all you really need is:


Private Sub Alert_AfterUpdate()
DoCmd.ApplyFilter , "[Alert]=True"
End Sub


HTH
 
J

Jean-Paul

Thanks Steve...
I think my filter-problems all are solved now and everything works just
like I want it to.

Great help

CU
JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top