SlideShare a Scribd company logo
1 of 16
Datatypes, Field
Properties, Validation and
        Masking
       By Emma Riley
Data Types
Data type         Description
Auto Number       Automatically generates a
                  number each time you add a
                  record, it is used as a unique
                  identifier for each record.
Text              Stores letters, numbers and
                  any combination. Can be up to
                  255 characters in length.
Memo              This is a really big text field/ It
                  can hold up to 64,000
                  characters.
Number            Holds numbers and decimal
                  points but nothing else. Set a
                  field as number if you wish to
                  do calculations.
Currency          Formats money fields.
Data Types cont.
Data type            Description
Date/Time            Either the date or the time or
                     even both, in a variety of
                     formats.
Yes/No               For fields where one of the
                     two answers is required.
OLE Object           You can add photographs,
                     sounds etc. in a field of this
                     data type.
Hyperlink            For webpage addresses.
Lookup Wizard        Prevent errors by presenting
                     the user with answers to
                     choose from.
Field Properties
Property            Description
Field Size          Used to fix the maximum
                    length of a text field which is
                    255 characters.
Format              This fixes how data can be
                    displayed, for example dates
                    can be displayed in many
                    different forms such as
                    13/01/01 or 13 jan 01
Input Mask          This sets a pattern for the data
                    to be entered into this field.
Caption             This is the field label in a form
                    or report.
Field Properties cont.
Property            Description
Default Value       The value entered into the
                    field when the record is
                    created. It is usually left blank
                    but can be very powerful.
Validation Rule     This defines the data entry
                    rules.
Validation Text     This is the error message if
                    data is invalid.
Required            Indicates whether an entry
                    must be made or not.
Indexed             This allows data to be stored
                    in the order of this field, which
                    speeds up searches.
Allow zero length   Used with text fields to decide
                    whether records in that field
                    are allowed to contain zero
                    length or empty text strings.
Field Properties cont.
Property              Description
Unicode compression   Method of compressing the
                      data entered into this field.
IME Mode              Input method editor, which
                      allows special character input.
IME Sentence Mode     Allows special character input.
Formats
• You can use a format if you want to change the way your data appears on
  screen.
• Each field type has its own set of formats. Some of the most commonly
  used are as follows:

Text and Memo Formats
Symbol            Meaning           What it does
>                 Greater than      Makes all text
                                    appear in upper
                                    case
<                 Less than         Makes all text
                                    appear in lower
                                    case
Formats cont.
Currency Formats


General Number                      Default option
Currency                            Displays numbers as currency
Fixed                               Locks the field to display a
                                    specified number of decimal
                                    places.
Standard                            Adds a thousands separator.
Percent                             Displays decimal places as a
                                    percentage.

In a number field, you can change the Field Size setting from Long Integer to Single if you
want to dispense with decimal places. However, if the field is part of a relationship, you
should be aware that an AutoNumber field must be set to Long Integer.
Formats cont.
Date/Time formats
You have a choice of how the date/time is displayed



Yes/No Formats
You have three initial choices, which are Yes/No, True/False and On/Off. You can add your own selections to
this list.



The Default Field Property
Default values are added automatically when you add a new record. For example in a table of names and
addresses you might set the Town field Brighton. Brighton then appears automatically each time a new
record is added and the user can either leave it or change it to something else.

You can also use expressions in this field property. Typically =Date() will return the current date from your
PC.

In a Library Book Loaning System the default value for the Date of Loan field could be set to =Date() and ,
similarly for the Date of Return the default value could be set to =Date()+14 (assuming a 14-day loan period).
Validation and Required Fields
 Validation tests and required fields are your weapons in the war against bad data.
 Using the Required property is easy because there are only two choices – yes and no. Set the
 Required property to Yes if you want to force the user to enter something in this field.

 Setting Validation Rules
 The Validation property is more sophisticated because it performs a test on incoming data to
 make sure it’s what you want.

 Two properties require your attention:



Validation Rule                     Test that will be applied to the
                                    data.
Validation Text                     Message which ACCESS will
                                    display if the data is
                                    unacceptable.
Validation and Required Fields cont.
•        Validations work best with number, currency and date fields because the incoming data is
         more predictable. An Expression is an instruction that you give to Access in a language that
         Access can understand. For example, if you want to force users to enter only positive
         numbers in a number field, the expression is “> 0” i.e. the number must be greater than zero.

    Operator                                         Meaning
    >0                                               Must be greater than zero
    <>0                                              Cannot be zero
    >=5                                              Greater than or equal to 5
    >=0 And <=100                                    Must be between 0 and 100
    <=0 Or <=100                                     Must be less than 0 or greater than 100

    >=Date()                                         Must be todays date or later
    >=Date() Or Is Null                              Must be todays date or later or blank

    >=#1/1/96# And <#1/1/97#                         Must be a date in 1996
    Like “A????”                                     Entry must contain the letter A
•   To write a validation rule, you can either write the rule yourself, or you can use the
    Expression Builder. To start the Expression Builder, click the Build button that
    appears when you select the Validation Rule Property.




The Expression Builder helps you to write expressions. It lists functions and operators
that you can use. It can also prompt you to remind you what to do next and it will
stop you making common mistakes.
Example             Possible validation text
>8000               Please enter a salary greater
                    than £8000
<#01/01/01#         You must enter dates before
                    jan 1st 2001
>Date()             The date returned must be
                    after todays date
‘S’ or ‘M’ or ‘L’   Sizes can only be S, M or L
Between 0 and 36    Goals scored cannot be
                    greater than 36
<20                 Age of student must be less
                    than 20
IN(‘A’, ‘B’, ‘C’)   Grades must be A, B or C
Input Masks

The aim of an Input Mask is to prevent the user entering bad data and to
remove data inconsistencies from occurring. The great danger in using them
is that you might end up preventing the user from entering correct data. For
this reason, you must think carefully before deciding to set an input mask for
a field.
Input masks make data entry easier. They display on screen a pattern for the
data to be entered into the field.
An input mask is a series of characters, which tells Access what kind of data to
expect. Each field can have an input mask, with the exception of a memo
field.
They are suitable for data that always has the same pattern s such as phone
numbers, national insurance numbers and postal codes.
You can either write your own input mask or you can use the Wizard. To use
the Wizard, click the Build button, which appears when you click the Input
Mask Property.
Characters for input masks you are likely to use
are as follows:

0        A number (0-9 must be entered)
9        A number (0-9 may be entered)
#        A number, + or- sign or space may be
entered
L        A letter A-Z must be entered
?        A letter A-Z may be entered
A        A letter or digit must be entered
a        A letter or digit may be entered
C        Any character or space may be
entered
&        Any character or space must be
entered
<        All characters to the right are
changed to lower case
>        All characters to the right are
changed to upper case
Examples of Input Masks

A National insurance number in the UK must be of the form AB123456C. All letters are in
capitals. Its input mask would be >LL000000L (it must be two letters followed by six numbers
and one letter).

A postcode consists of one or two letters, then one or two numbers, then a space, a number
and two letters. All the letters must be capital letters. Examples are B1 1BB or DE13 0LL. The
input mask would be >L?09 0LL.

Car Registration numbers such as FN03 ANJ would have >LL00 LLL as an input mask.

F2 Select an entire field
Ctrl+; Insert the Current Date
Ctrl+: Insert the Current Time
Ctrl+Enter Insert a Line Break (use it in a memo or large text field)
Ctrl++ Add New Record
Ctrl+- Delete the Current Record
Shift+Enter Save the Record
Ctrl+Z     Undo the last change you made (don't rely on this)
Ctrl+Enter Open the selected object in Design View
Alt+F4 Quit Access

More Related Content

What's hot

Module 5 entering data in worksheet
Module 5 entering data in worksheetModule 5 entering data in worksheet
Module 5 entering data in worksheet
Dr. Shalini Pandey
 
MICROSOFT EXCEL (ICTL)
MICROSOFT EXCEL (ICTL)MICROSOFT EXCEL (ICTL)
MICROSOFT EXCEL (ICTL)
Nad0209
 
Cd ict-worksheet-la2-form-4
Cd ict-worksheet-la2-form-4Cd ict-worksheet-la2-form-4
Cd ict-worksheet-la2-form-4
cikgushaharizan
 

What's hot (13)

Module 5 entering data in worksheet
Module 5 entering data in worksheetModule 5 entering data in worksheet
Module 5 entering data in worksheet
 
MICROSOFT EXCEL (ICTL)
MICROSOFT EXCEL (ICTL)MICROSOFT EXCEL (ICTL)
MICROSOFT EXCEL (ICTL)
 
Pen drive
Pen drivePen drive
Pen drive
 
Cd ict-worksheet-la2-form-4
Cd ict-worksheet-la2-form-4Cd ict-worksheet-la2-form-4
Cd ict-worksheet-la2-form-4
 
Expansion card or Add on card Power point Presentation.
Expansion card or Add on card Power point Presentation.Expansion card or Add on card Power point Presentation.
Expansion card or Add on card Power point Presentation.
 
Basic Ms excel
Basic Ms excelBasic Ms excel
Basic Ms excel
 
Spreadhsheets 1
Spreadhsheets 1Spreadhsheets 1
Spreadhsheets 1
 
File Management
File ManagementFile Management
File Management
 
Introduction - Database (MS Access)
Introduction - Database (MS Access)Introduction - Database (MS Access)
Introduction - Database (MS Access)
 
How to install Windows 7
How to install Windows 7 How to install Windows 7
How to install Windows 7
 
Presentation (sharing folder)
Presentation (sharing folder)Presentation (sharing folder)
Presentation (sharing folder)
 
Hard disk
Hard diskHard disk
Hard disk
 
Windows 7 VS Windows 8
Windows 7 VS Windows 8Windows 7 VS Windows 8
Windows 7 VS Windows 8
 

Viewers also liked

Data Types And Field Properties
Data  Types And  Field  PropertiesData  Types And  Field  Properties
Data Types And Field Properties
wmassie
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masks
fizahPhd
 
18 database features
18 database features18 database features
18 database features
Rebecca Jones
 
The Key Features Of A Database
The Key Features Of A DatabaseThe Key Features Of A Database
The Key Features Of A Database
stan300
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentals
wmassie
 
Validation rule, text and input masks
Validation rule, text and input masksValidation rule, text and input masks
Validation rule, text and input masks
fizahPhd
 
Revision week 2
Revision week 2Revision week 2
Revision week 2
fizahPhd
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
wmassie
 
Validation and Verification
Validation and VerificationValidation and Verification
Validation and Verification
mrmwood
 
Math1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and HexMath1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and Hex
gcmath1003
 

Viewers also liked (20)

Data Types And Field Properties
Data  Types And  Field  PropertiesData  Types And  Field  Properties
Data Types And Field Properties
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masks
 
18 database features
18 database features18 database features
18 database features
 
The Key Features Of A Database
The Key Features Of A DatabaseThe Key Features Of A Database
The Key Features Of A Database
 
Intro databases
Intro databasesIntro databases
Intro databases
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentals
 
Silabus KKPI SMK; Mengoperasikan PC Stand Alone
Silabus KKPI SMK; Mengoperasikan PC Stand AloneSilabus KKPI SMK; Mengoperasikan PC Stand Alone
Silabus KKPI SMK; Mengoperasikan PC Stand Alone
 
Exam guide and practice in access
Exam guide and practice in accessExam guide and practice in access
Exam guide and practice in access
 
Validation rule, text and input masks
Validation rule, text and input masksValidation rule, text and input masks
Validation rule, text and input masks
 
Revision week 2
Revision week 2Revision week 2
Revision week 2
 
Xi 1-basis data 2 edit
Xi 1-basis data 2 editXi 1-basis data 2 edit
Xi 1-basis data 2 edit
 
Fundamentals of Database Design
Fundamentals of Database DesignFundamentals of Database Design
Fundamentals of Database Design
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
New Perspectives: Access.06
New Perspectives: Access.06New Perspectives: Access.06
New Perspectives: Access.06
 
Validation and Verification
Validation and VerificationValidation and Verification
Validation and Verification
 
Validation and verification
Validation and verificationValidation and verification
Validation and verification
 
Ms access 2010
Ms access 2010Ms access 2010
Ms access 2010
 
Math1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and HexMath1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and Hex
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database system
 
Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalization
 

Similar to Datatypes, Field Properties, Validation and Masking

Doublebookings1
Doublebookings1Doublebookings1
Doublebookings1
JTHSICT
 
Visual Basics for Application
Visual Basics for Application Visual Basics for Application
Visual Basics for Application
Raghu nath
 
Introduction TO Microsoft Access
Introduction TO Microsoft AccessIntroduction TO Microsoft Access
Introduction TO Microsoft Access
Chhom Karath
 
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptxROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
DishantGola
 

Similar to Datatypes, Field Properties, Validation and Masking (20)

Access
AccessAccess
Access
 
Field properties
Field propertiesField properties
Field properties
 
Field properties
Field propertiesField properties
Field properties
 
002.table
002.table002.table
002.table
 
Validation and input formatting
Validation and input formattingValidation and input formatting
Validation and input formatting
 
Field Types
Field TypesField Types
Field Types
 
Micro Soft Access - Working with Fields
Micro Soft Access - Working with FieldsMicro Soft Access - Working with Fields
Micro Soft Access - Working with Fields
 
INTRODUCTION TO C
INTRODUCTION TO CINTRODUCTION TO C
INTRODUCTION TO C
 
MSAvMySQL.pptx
MSAvMySQL.pptxMSAvMySQL.pptx
MSAvMySQL.pptx
 
Ppt lesson 05
Ppt lesson 05Ppt lesson 05
Ppt lesson 05
 
Lesson 5 PP
Lesson 5 PPLesson 5 PP
Lesson 5 PP
 
Doublebookings1
Doublebookings1Doublebookings1
Doublebookings1
 
Ppt lesson 07
Ppt lesson 07Ppt lesson 07
Ppt lesson 07
 
Visual Basics for Application
Visual Basics for Application Visual Basics for Application
Visual Basics for Application
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Visual Basic Fundamentals
Visual Basic FundamentalsVisual Basic Fundamentals
Visual Basic Fundamentals
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
 
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
 
Introduction TO Microsoft Access
Introduction TO Microsoft AccessIntroduction TO Microsoft Access
Introduction TO Microsoft Access
 
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptxROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
ROLL NO 1 TO 9(G1) USE OF EXCEL IN CA PROFESSION (Final Draft).pptx
 

Recently uploaded

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Datatypes, Field Properties, Validation and Masking

  • 1. Datatypes, Field Properties, Validation and Masking By Emma Riley
  • 2. Data Types Data type Description Auto Number Automatically generates a number each time you add a record, it is used as a unique identifier for each record. Text Stores letters, numbers and any combination. Can be up to 255 characters in length. Memo This is a really big text field/ It can hold up to 64,000 characters. Number Holds numbers and decimal points but nothing else. Set a field as number if you wish to do calculations. Currency Formats money fields.
  • 3. Data Types cont. Data type Description Date/Time Either the date or the time or even both, in a variety of formats. Yes/No For fields where one of the two answers is required. OLE Object You can add photographs, sounds etc. in a field of this data type. Hyperlink For webpage addresses. Lookup Wizard Prevent errors by presenting the user with answers to choose from.
  • 4. Field Properties Property Description Field Size Used to fix the maximum length of a text field which is 255 characters. Format This fixes how data can be displayed, for example dates can be displayed in many different forms such as 13/01/01 or 13 jan 01 Input Mask This sets a pattern for the data to be entered into this field. Caption This is the field label in a form or report.
  • 5. Field Properties cont. Property Description Default Value The value entered into the field when the record is created. It is usually left blank but can be very powerful. Validation Rule This defines the data entry rules. Validation Text This is the error message if data is invalid. Required Indicates whether an entry must be made or not. Indexed This allows data to be stored in the order of this field, which speeds up searches. Allow zero length Used with text fields to decide whether records in that field are allowed to contain zero length or empty text strings.
  • 6. Field Properties cont. Property Description Unicode compression Method of compressing the data entered into this field. IME Mode Input method editor, which allows special character input. IME Sentence Mode Allows special character input.
  • 7. Formats • You can use a format if you want to change the way your data appears on screen. • Each field type has its own set of formats. Some of the most commonly used are as follows: Text and Memo Formats Symbol Meaning What it does > Greater than Makes all text appear in upper case < Less than Makes all text appear in lower case
  • 8. Formats cont. Currency Formats General Number Default option Currency Displays numbers as currency Fixed Locks the field to display a specified number of decimal places. Standard Adds a thousands separator. Percent Displays decimal places as a percentage. In a number field, you can change the Field Size setting from Long Integer to Single if you want to dispense with decimal places. However, if the field is part of a relationship, you should be aware that an AutoNumber field must be set to Long Integer.
  • 9. Formats cont. Date/Time formats You have a choice of how the date/time is displayed Yes/No Formats You have three initial choices, which are Yes/No, True/False and On/Off. You can add your own selections to this list. The Default Field Property Default values are added automatically when you add a new record. For example in a table of names and addresses you might set the Town field Brighton. Brighton then appears automatically each time a new record is added and the user can either leave it or change it to something else. You can also use expressions in this field property. Typically =Date() will return the current date from your PC. In a Library Book Loaning System the default value for the Date of Loan field could be set to =Date() and , similarly for the Date of Return the default value could be set to =Date()+14 (assuming a 14-day loan period).
  • 10. Validation and Required Fields Validation tests and required fields are your weapons in the war against bad data. Using the Required property is easy because there are only two choices – yes and no. Set the Required property to Yes if you want to force the user to enter something in this field. Setting Validation Rules The Validation property is more sophisticated because it performs a test on incoming data to make sure it’s what you want. Two properties require your attention: Validation Rule Test that will be applied to the data. Validation Text Message which ACCESS will display if the data is unacceptable.
  • 11. Validation and Required Fields cont. • Validations work best with number, currency and date fields because the incoming data is more predictable. An Expression is an instruction that you give to Access in a language that Access can understand. For example, if you want to force users to enter only positive numbers in a number field, the expression is “> 0” i.e. the number must be greater than zero. Operator Meaning >0 Must be greater than zero <>0 Cannot be zero >=5 Greater than or equal to 5 >=0 And <=100 Must be between 0 and 100 <=0 Or <=100 Must be less than 0 or greater than 100 >=Date() Must be todays date or later >=Date() Or Is Null Must be todays date or later or blank >=#1/1/96# And <#1/1/97# Must be a date in 1996 Like “A????” Entry must contain the letter A
  • 12. To write a validation rule, you can either write the rule yourself, or you can use the Expression Builder. To start the Expression Builder, click the Build button that appears when you select the Validation Rule Property. The Expression Builder helps you to write expressions. It lists functions and operators that you can use. It can also prompt you to remind you what to do next and it will stop you making common mistakes.
  • 13. Example Possible validation text >8000 Please enter a salary greater than £8000 <#01/01/01# You must enter dates before jan 1st 2001 >Date() The date returned must be after todays date ‘S’ or ‘M’ or ‘L’ Sizes can only be S, M or L Between 0 and 36 Goals scored cannot be greater than 36 <20 Age of student must be less than 20 IN(‘A’, ‘B’, ‘C’) Grades must be A, B or C
  • 14. Input Masks The aim of an Input Mask is to prevent the user entering bad data and to remove data inconsistencies from occurring. The great danger in using them is that you might end up preventing the user from entering correct data. For this reason, you must think carefully before deciding to set an input mask for a field. Input masks make data entry easier. They display on screen a pattern for the data to be entered into the field. An input mask is a series of characters, which tells Access what kind of data to expect. Each field can have an input mask, with the exception of a memo field. They are suitable for data that always has the same pattern s such as phone numbers, national insurance numbers and postal codes. You can either write your own input mask or you can use the Wizard. To use the Wizard, click the Build button, which appears when you click the Input Mask Property.
  • 15. Characters for input masks you are likely to use are as follows: 0 A number (0-9 must be entered) 9 A number (0-9 may be entered) # A number, + or- sign or space may be entered L A letter A-Z must be entered ? A letter A-Z may be entered A A letter or digit must be entered a A letter or digit may be entered C Any character or space may be entered & Any character or space must be entered < All characters to the right are changed to lower case > All characters to the right are changed to upper case
  • 16. Examples of Input Masks A National insurance number in the UK must be of the form AB123456C. All letters are in capitals. Its input mask would be >LL000000L (it must be two letters followed by six numbers and one letter). A postcode consists of one or two letters, then one or two numbers, then a space, a number and two letters. All the letters must be capital letters. Examples are B1 1BB or DE13 0LL. The input mask would be >L?09 0LL. Car Registration numbers such as FN03 ANJ would have >LL00 LLL as an input mask. F2 Select an entire field Ctrl+; Insert the Current Date Ctrl+: Insert the Current Time Ctrl+Enter Insert a Line Break (use it in a memo or large text field) Ctrl++ Add New Record Ctrl+- Delete the Current Record Shift+Enter Save the Record Ctrl+Z Undo the last change you made (don't rely on this) Ctrl+Enter Open the selected object in Design View Alt+F4 Quit Access