During the design of a table, how may I change the field's position?

Hello
I am having a little problem… and I don’t know very well how to solve it.
Let’s imagine I am in the design View and I have a table with the following fields
NAME
LASTNAME
ADDRESS
CITY
COUNTRY
PHONENUMBER

ok… that is my table and I am in the design view…

Now I realize I want to add an additional field AGE…
ok… I add AGE and what I have is this…

NAME
LASTNAME
ADDRESS
CITY
COUNTRY
PHONENUMBER
AGE

cool… but when I open the table I see age is at the end… and I would like to put it in the 3rd possition, because it’s more logic to add the name, last name and then age, so instead having the ADDRESS field int he 3rd possition… I would like to move AGE from the very end… some possitions up…

How may I do this? I try to drag and drop it… but doesn’t work
I try to cut it and past it, but yes, I can cut it but doesn’t allow me to paste it?
so how may I do a simple thing like this, just moving the field some possitions up, how may I do this?

In access it’s as easy as drag and drop… but in LibreOffice I try to do this and it’s impossible…

Have you explored creation of a “view”? This should do what you want.

In the left side under Database, select Tables - in the Tasks pane select Create View…

I haven’t really used or experimented with Views but a View seems to be very much the same as a query.

See the “Hey, good question…” answer here below, because I think that although this provides a workaround, it does not really answer the original question, and the other answer does answer it.

Hey, good question, and I fully understand why you would want to arrange the table like you want it instead of using a view, query, or form to see it in a different arrangement. Here is the solution I found: In the window where you see the name of your table, right click on it, and choose copy. Then right click again in an open area near the name, and choose paste. Choose a new name, which can be changed later, and click next. A window will come up with all the fields listed. Select them one at a time and use the > to add them to the new table, in the order you want. Check each field to be sure it is the format you want and then create. The fields will be in the order you want. Rename the old table to something else and rename the new one to the name you want to use. Save the old one as a backup. OK? Good question.

1 Like

Thanks a bunch!

This did the trick! summary: create a new table inserting each field from old table.

Adding a column in the middle of a table with the embedded database is possible, but tricky (at least with LibreOffice 3.6.0.4). The embedded database uses HSQLDB version 1.8. The relevant command is here link text.

You need to use the SQL tool (Tools/SQL). Type in your command, e.g. ALTER TABLE YOURTABLE ADD COLUMN AGE INTEGER BEFORE ADDRESS; and execute. Immediately either refresh tables (View/Refresh Tables) or close LibreOffice and reopen it. If I did not do either of these steps then LibreOffice crashed and the column was not added (on Windows 7).

However I agree with JohnD. You can use a view or firm to arrange the columns as you wish. A form also lets you set field widths.

Another simple solution is left click on the table select edit field list appears go to the last one hi-lite it click select cut move down to the empty row below click and paste data. You now have an empty row click cut and paste until you have the empty position you want for the new field. Works for small number of fields. For large tables use solution above.

This doesn’t work for me. When you paste it jumps up to the place it was in before. It doesn’t like blank fields. The solution is to put any character in the field name before pasting below it.

This worked for me…

Create a view with the columns in the desired order and save it.
In the main window on the new view, right select “copy”.
Again in the main window right select “Paste Special” and select “Data Source Table”.
Follow through to create the table.
Delete any references to the old table, then delete the old table, rename your new reordered table and re-establish all the deleted links.