Delete Empty records in an access numeral library

Source: Internet
Author: User
Tags expression logical operators microsoft sql server access database microsoft access database

To delete an empty record in an access numeral library:

Indicates that no data exists with a 0-length character

To indicate that no data exists in a Microsoft Access database, you can enter a 0-length string (0-length string: A string that contains no characters) in the text or Memo field. You can use a 0-length string to indicate that you know that the field has no value. The way to enter a 0-length string is to type two double quotes ("") that do not have spaces between each other. )。 In a Microsoft Access project that connects to a Microsoft SQL Server database (Microsoft Access project: Acces that is connected to a Microsoft SQL Server database and used to create a client/server application S file. The project file does not contain any data or objects that are based on data definition, such as tables or views. Can be in its data type data type: A field feature that determines the type of data that a field can have. Data types include Boolean, Integer, Long, Currency, single, Double, Date, String, and Variant (default). Enter a 0-length string for the varchar or nvarchar field.

Open a datasheet Datasheet view: A window in a row or column format that displays from a table, form, query, view, or stored procedure. In Datasheet view, you can edit fields, add and delete data, and search for data. Or in Form view Form view: A window that displays a form to display or accept data. Form view is the primary way to add and modify data in a table. You can also change the design of the form in this view. ) to open the form.

To enter a 0-length string in a field, type a double quotation mark ("") with no spaces in the middle.

Double quotes disappear even when you move to a different field or object, but the field is still a zero-length string.

The difference between a Null value and a 0-length string (MDB)

/* Note the information in this topic applies only to Microsoft Access databases (. mdb). */

The view contains null (NULL: Can be entered in a field or used in expressions and queries to indicate missing or unknown data.) In Visual Basic, the null keyword represents a null value. Some fields, such as primary key fields, may not contain Null values. Value and a 0-length string (0-length string: A string that contains no characters.) You can use a 0-length string to indicate that you know that the field has no value. The way to enter a 0-length string is to type two double quotes ("") that do not have spaces between each other. Data, the fields appear to be the same, with no values. However, you can use expression expressions: Any combination of arithmetic or logical operators, constants, functions, and field names, controls, and properties to evaluate to a single value. An expression can perform calculations, manipulate characters, or test data. To differentiate between Null values and 0-length strings.

In Design view Design view: A window that displays the design of database objects, including tables, queries, forms, macros, and data access pages. In Design view, you can create new database objects and modify the design of existing database objects. Open the form, report, or data access page.

In the query design grid design grid: The grid that you use to design a query or filter in query Design view or the Advanced Filter/Sort window. For queries, the grid was formerly known as the QBE grid. , or in an unbound control (unbound control: A control that is not connected to a field in the underlying table, query, or SQL statement.) Unbound controls are typically used to display informational text or decorative pictures. ), type the following expression in the control source. Replace FieldName with a field name that contains a Null value and a 0-length string.

=iif (IsNull ([fieldname]), "Unknown", Format ([fieldname], "@; Zls "))

If the field contains Null, the expression returns "Unknown", and if the field contains a 0-length string, the expression returns "Zls". Otherwise, an expression returns the value to the field.

Things appear in the work of a crawl online information, may not consider the whole, caught the information in the library is part of the empty, so that my need to empty records deleted, tried a lot of ways not, and finally found the above Microsoft Access Help document to solve the problem.

Perform:

Sql= "Delete from the news where IIf (IsNull), ' Unknown ', Format ([City], ' @; Zls ') = ' Unknown ' "

Conn.execute (SQL)

OK, Fix it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.