On Dec 6, 2007 2:10 PM, J Diggan <[EMAIL PROTECTED]> wrote:

> /I am using version 2.3.1 of OpenOffice.org. My problem is :
>
> How do I change an existing table field to required ?
>
> John,

Base is not real graceful about this. If you've got a field to change to
"reqired" and the field is not filled in for every row in the table the
change will fail. So..

Instructions(A) - IF the field that you want to make required already has a
value for every row...
1. right-click the table name
2. select Edit from the popup menu
3. click on the field name you wish to change in the field list list
4. in the Field Properties options at the bottom of the dialog box, change
the Entry required option to "Yes"
5. save your change

Instructions(B) - IF the field you wish to make required is not currently
filled in on every row then you have to fill in the blanks before you can
make it required...

1. make a copy of your table to practice with, errors from what follows
aren't easily undone.
1.1 right-click on your table
1.2 select Copy from the menu
1.3 right-click again
1.4 select Paste from the menu (this will create the copy of the table that
you will practice with)
2. click on the Tools menu and select the SQL option
3. in the area where it reads "Command to execute" type the following SQL
statement
UPDATE "tablename" SET "fieldname1" = 'newvalue' WHERE "fieldname2" IS NULL
then click the Execute button

For #3 note the following:
tablename - substitute the name of your practice table
fieldname1 - substitute the name of the field that needs to have the blanks
filled in
fieldname2 - for what you need to do, put a value in empty fields, it is the
same as fieldname1
newvalue - something you want to fill in the empty fields with, should be
something you can identify as boilerplate so it can be updated to something
meaningful later
" (double quotes) - are required in the SQL statement where they are shown
' (single quotes) - are required in the SQL statement where they are shown
I've presumed the field you need to fill in is text hence the single quotes.
If the value is numeric you can dispense with the single quotes. If the
field needs to be filled in with some other type of value please post more
details on this list.

Practice these steps until you are able to fill in the blanks in your copied
table without error. Once you are able to do so change tablename to the name
of the table that you really want to change and execute the query again.

Now that the query is run go back to Instructions(A) to make the field
required.

Reply via email to