Manolis Christodoulou wrote:

Nobody answered so far, please allow me to ask again...

Is there a way to have a table control in a form, that contains fields from more than one database table? I know how can I do it using queries or views, but then the table isn't editable. Any workarround?

Thanks.

It depends on what you want to edit.

Using OO 2.0.2 there is a very limited support for this with the embedded HSQL database, whether it works with other database connections I don't know.

A query the joins two tables using a left outer join, not an inner join, will allow you to edit the data in the left table.

For example, if I have two tables 'Wdgets' and 'Sub_Assemblies'.

Widgets ( ID, WidetName, Cat_No, Prod_Mgr )
Sub_Assemblies( ID, WidgetID, AssemblyName, PartNo )

Then I could use the query designer to generate this :

SELECT "SUB_ASSEMBLIES"."ID", "SUB_ASSEMBLIES"."WIDGET_ID", "SUB_ASSEMBLIES"."SUB_ASSEMBLY", "WIDGETS"."CAT_NUM", "WIDGETS"."PROD_MGR" FROM { OJ "SUB_ASSEMBLIES" "SUB_ASSEMBLIES" LEFT OUTER JOIN "WIDGETS" "WIDGETS" ON "SUB_ASSEMBLIES"."WIDGET_ID" = "WIDGETS"."ID" }


The query will return an updatable result set, but only for the table 'Sub_Assemblies'. So if I had a table grid based on it, I would use a list box control for he Widget_ID field that would display the WidgetName field. I can use the table to edit existing sub_assemblies records or to insert new ones and the additional information is automatically displayed. This will work if a view is on the right side of the join also.

OK, I know this is pretty limited but so far seems to be the only thing available - not using some custom code.

Sincerely

Drew


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to