Limit what can be put into a field

Creating tables and queries
Post Reply
tomwatson
Posts: 6
Joined: Wed May 07, 2008 10:41 am

Limit what can be put into a field

Post by tomwatson »

Is it possible to limit what can be put into a field to a select set of options? Such as allowing a user to enter into a Title field Mr, Mrs or Ms but nothing else.

Any help on the issue would be appreciated.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Limit what can be put into a field

Post by Villeroy »

New table "Salutations" with 2 fields:
ID [Integer, auto-value, primary key]
Text

Put the valid salutations into the table:

Code: Select all

1 Mr
2 Mrs
3 Ms
Your table which describes the persons gets the ID numbers of the salutation rather than the salutation text.

Code: Select all

Name Sal_ID
John  1
Mary 2
Missy 3
Tools>Relations...
Drag a relation from Salutations.ID to Persons.Sal_ID

Alternatively you may have a look at form "movies_flat" in this database: http://user.services.openoffice.org/en/ ... php?id=649
Open in edit mode, right-click column "Genre">Column... tab "Data". This lets you choose from already existing movie genres but nothing prevents you from entering anything else directly into the table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply