To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=30988
------- Additional comments from [EMAIL PROTECTED] Thu Jun 9 09:00:55 -0700 2005 ------- I have developed this workaround : Function generateId ( DatenquellenName as String) as Long ' Variable declaration Dim DatenbankKontext as Object Dim Datenquelle as Object Dim Verbindung as Object Dim Statement as Object Dim ResultSet as Object Dim newpk as Long ' Datenbank-Kontext holen DatenbankKontext = createUnoService _ ( "com.sun.star.sdb.DatabaseContext" ) ' Datenquelle holen Datenquelle = DatenbankKontext.getByName( DatenquellenName ) ' Verbindung erstellen Verbindung = Datenquelle.getConnection( "", "" ) ' Statement erzeugen Statement = Verbindung.createStatement() ' Abfrage absetzen 'oracle way of retrieving a primary key ' postgresql works smilar ResultSet = Statement.executeQuery( "select probe_id_seq.nextval from dual") ResultSet.next() newpk = ResultSet.getInt( 1 ) ' ResultSet, Verbindung und Statement brav schliessen ResultSet.close() Statement.close() Verbindung.close() generateId = newpk End Function Sub approveRowChange(Event as Object ) Dim Form as Object Dim SubForm as Object Dim PosId as Integer Dim NewId as Long Dim CurId as Long DIM Doc as Object Dim ret as boolean Dim StatusColId as Integer Dim tmpStatus as Integer Dim ElongLegal as boolean Dim GageLegal as boolean Dim CrossLegal as boolean dim FormDbId as integer dim ElongationDbId as integer Dim ElongColId as Integer Dim CrossSectionColId as Integer Dim GageLengthColId as Integer ' Keine Fehler tmpStatus = 0 'MsgBox Event.DBG_Properties 'MsgBox Event.Action if ( not Event.Action = com.sun.star.sdb.RowChangeAction.INSERT ) then Exit Sub end if Doc = ThisComponent Form = Doc.DrawPage.Forms.GetByName("Standard") StatusColId = Form.findColumn("STATUS") if ( Not Form.supportsService( "com.sun.star.form.component.DataForm" ) ) Then msgBox "No DataForm fired" Exit Sub End If ' Wert der Listbox Form ermitteln FormDbId=getListboxDatabaseId(Form,"ListBoxForm") ' Wert der Listbox Elongation ElongationDbId=getListboxDatabaseId(Form,"ListBoxElongation") ' prufen ob elongation listbox auf richtigem wert checkElong tmpStatus=getCrossSection tmpStatus=getGageLength PosId = Form.findColumn("PROBE_ID") CurId = Form.getInt(PosId) Form.updateInt(StatusColId,tmpStatus) if tmpStatus < 0 Then setListboxBgColor(Doc,Form,"STATUS",COLOR_RED) End If if ( CurId = PK_DEFAULT or CurId = 0 ) Then 'generate a new id NewId = generateID(Form.DataSourceName) Form.updateInt(PosId,NewId) End If End Sub If you connect the function approveRowChange to the form event "before record change" you can retrieve the primary key from the database and update the primary key field. I think we shall close this issue and produce a HowTo ("how do i get database primary key into a form") instead. So we have a workaround and a way to use OO with RDBMS like Oralce and Postgres. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]