Solved

How not show records on a form bound to a table

Posted on 2014-10-16
4
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 36

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 50

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 36

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 50

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Null or "" 28 53
Convert VBA UDF to SQl SERVER UDF 4 52
Access query error 3 26
Displaying images within Access Form 6 28
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

696 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