Solved

How not show records on a form bound to a table

Posted on 2014-10-16
4
137 Views
Last Modified: 2014-10-17
I have a form which is bound to a table.  Some of the records in the table do not have data in the field named "Description"  If there is nothing in the description field I do not want those records to show in the form (continuous form by default).

I thought I could do it with in the onopen event of the form but this doesn't work:

    Me.Filter = [Description] <> "*"
    Me.FilterOn = True
0
Comment
Question by:SteveL13
  • 2
  • 2
4 Comments
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 40385303
Change the form's RecordSource query to include criteria so the records are never retrieved.

Select ..
From ..
Where Description & "" <> "";

I could have said:
Where Not (Description Is Null) AND Not (Description = "")
but the first expression handles both nulls and ZLS and is easier to understand.  Compound negatives can get confusing.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 40385378
This should do it:

     Me.Filter = "[Description] Is Not Null"
     Me.FilterOn = True

/gustav
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 40385652
Gus,
That assumes the Description is null.  It may be a ZLS which is indistinguishable visually.  In most cases, I do not allow ZLS in my tables.  They cause nothing but confusion and extra work.  It is only imports from other applications that may include them and only in staging tables.

A common way to get a ZLS in a text field that isn't set to prevent them is via a form.  If the user enters a value in a text field and then changes his mind and uses the backspace to get rid of the typing, a ZLS is saved in the field rather than null.  Access knows the field was dirtied but is now empty so it saves a ZLS.  Of course, you would get an error on save if the table does not allow ZLS.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40386113
>  I do not allow ZLS in my tables.

Neither do I, and you have to actively select it. In most cases, if it is allowed, it's by an error.
That's why my filter string should do it; the wording is carefully selected.

/gustav
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now