Hi Ariel,

> If I understood well, they are talking about a REPORT, not a FORM.

Oop. Being able to read is certainly an advantage. Fortunately no from
an evolutionary point of view, else I would be extinct ...

My apologies for giving false hope ...

> I think they have a form, and they want to print a REPORT for the 
> current record they see in the form.

Well .... my idea here would be to have a report bound to a certain
query of the form SELECT ... FROM ... WHERE ..., and to modify this
query's WHERE clause to filter for the form's current record (e.g. to
SELECT ... FROM ... WHERE ( ... ) AND ID = <current_form_id>).

  ' get the SQL statement which uniquely identifies the current
  ' record
  composer = createUnoService( _
    "com.sun.star.sdb.SingleSelectQueryComposer" )
  composer.setQuery( form.ActiveCommand )
  composer.appendFilterByColumn( _
    form.getColumns().getByIndex/Name( ... ) )
    ' not this should be a column which uniquely identifies
    ' the current record of the form, ideally a primary key
    ' If you have multiple records which *together* identify
    ' the current record, then do repeated appendFilterByColumn
    ' calls
  sqlStatement = composer.getQuery()

  ' modify our query so it is now based on this statement
  query = form.ActiveConnection.getQueries().getByName( <query_name> )
  query.Command = sqlStatement

  ' execute the report
  ...

This is our of my head, so there might be errors in there, but I'd say
it should work along those lines.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

Reply via email to