View previous topic :: View next topic |
Author |
Message |
al3 Pure-blooded Human
Joined: Oct 28, 2007 Posts: 34
|
Posted: Wed Mar 09, 2011 3:24 pm Post subject: How do I change a form from read-only to read-write |
|
I created a form from a spreadsheet datasource. It is read-only. I'd like to be able to use it to change some of the data if necessary. I can't find the "property" on where to change it from read-only to read-write. Is there one?
Thanks.
Al |
|
Back to top |
|
|
al3 Pure-blooded Human
Joined: Oct 28, 2007 Posts: 34
|
Posted: Wed Mar 09, 2011 3:29 pm Post subject: |
|
I think I found out why. There is no primary key in the table. I can use the phone number field. How do I create a primary key and do I have to re-create the form or the database... from the spreadsheet?
Al |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Wed Mar 09, 2011 5:52 pm Post subject: |
|
I am not sure if I understand the entire problem but since setting a primary key in a table is a common requirement that Base imposes, here are the steps for making a column in an existing table the primary key. Note that when a column is set to the primary key, it will not allow that column's value to be duplicated in more than one row. So, in your case I would recommend setting the primary key to one or a combination fields that should be unique like name of the person or company:
1. Click on the Tables button in the Base document and then right-click or Control-click on the table that you need to edit. In the popup menu that appears, select the Edit menu.
2. In the Table Design window that appears, select one or a combination of columns (use Command-click to select multiple columns) that you want to be the primary key. Then right-click or Control-click in the gray area to the left of the selected columns. In the popup menu that appears, check the "Primary Key" menu.
3. Save the changes and reopen your form.
Can you input new records in your form after doing the above steps?
Patrick |
|
Back to top |
|
|
al3 Pure-blooded Human
Joined: Oct 28, 2007 Posts: 34
|
Posted: Wed Mar 09, 2011 6:26 pm Post subject: |
|
I don't think I'm using "Base." I have a Calc spreadsheet that I made into a datasource. From that I made a Form. But the form is read-only. I can't change data... probably because the underlying source (the spreadsheet) does not have a primary key.
So is there a way to designate a field (column) in the spreadsheet to be primary? Or is that done somewhere else? I looked in the ODB file but didn't see anything. I tried right-clicking on the Tables icon but nothing happens.
Al |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Wed Mar 09, 2011 6:56 pm Post subject: |
|
al3 wrote: | I don't think I'm using "Base." I have a Calc spreadsheet that I made into a datasource. From that I made a Form. But the form is read-only. I can't change data... probably because the underlying source (the spreadsheet) does not have a primary key. |
You can only set a primary key for tables within the Base .odb file. External files like Calc documents don't have any concept of primary keys in their files so you cannot set one.
But I don't think the problem is lack of a primary key. Instead, I think the issue is that you are trying to use a Base form to fill rows in a Calc document. I do not think that will work as they are really incompatible files so you only get the limited "read-only" feature. This is because Base forms edit by invoking SQL commands which Calc does not understand.
To make the form editable, I think you are going to need to move your Calc cells into a new table within your .odb file so that the Base form will be able to insert and edit rows using SQL commands.
Do you need steps to import your Calc data source into a Base file?
Patrick |
|
Back to top |
|
|
al3 Pure-blooded Human
Joined: Oct 28, 2007 Posts: 34
|
Posted: Wed Mar 09, 2011 8:14 pm Post subject: |
|
I think I can do the database creation function from Calc into a Base. However, maybe I can figure out how to get OO to recognize MySQL and I'll put my data in there. I'm sure there is a ton of info via Google on that.
Thanks.
Al |
|
Back to top |
|
|
pluby The Architect
Joined: Jun 16, 2003 Posts: 11949
|
Posted: Wed Mar 09, 2011 8:38 pm Post subject: |
|
al3 wrote: | I think I can do the database creation function from Calc into a Base. However, maybe I can figure out how to get OO to recognize MySQL and I'll put my data in there. I'm sure there is a ton of info via Google on that. |
Using MySQL as your database is definitely a more robust solution than putting the data within the .odb file IMHO. In my experience, file-based databases tend to be very fragile when more than one user is editing the database at the same. In contrast, server-based databases like MySQL are designed to handle multiple simultaneous connections to a database.
NeoOffice's underlying OpenOffice.org code has built-in support for connecting to MySQL databases so if you create a new .odb file using the File :: New :: Database menu, select the "Connect to an existing database" option and then select "MySQL" in the list immediately below, you can create an .odb file whose data source is a MySQL database server.
Patrick |
|
Back to top |
|
|
|