Hi Tommy,
>> oSubForm = oForm.getByName( "ProductsPricing" ) or shorter
>> oSubForm = oForm.ProductsPricing
>
> That updates the fields but doesn't commit the changes to the database.
The code you originally posted does not say anything about updates - so
what are you actually doing, and what do you want to achieve?
> If I click on a field in the subform and then click my save macro it
> will write the changes to the database. So I took the save macro code
> and added it to my calc macro but get an error.
>
> oSubForm.updateString(oW100, cWebPrice)
what are oW100 and cWebPrice
> dispatcher =
> createUnoService("com.sun.star.frame.DispatchHelper")
> dispatcher.executeDispatch(oSubForm, ".uno:RecSave", "", 0,
> Array())
That's never a good idea. What you do here is simulating pressing the
"Save record" button in the form navigation toolbar. You might have
noticed that this button always operates on the current sub/form, which
is defined by the control which currently has the focus.
Doing this programmatically, without knowing what's the current form,
might lead to all sort of undesired results.
I suggest something along those lines:
oControl = oSubForm.getByName( <control_name> )
' <control_name> being the name of the *control* bound to
' the column in question
oColumn = oControl.BoundField
' this actually is the column of the form
oColumn.updateString( <some_value> )
' write the value
If oSubForm.IsNew Then
oSubForm.insertRow()
Else
oSubForm.updateRow
End If
HTH
Ciao
Frank
--
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems http://www.sun.com/staroffice -
- OpenOffice.org Database http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]