Delphi - Informe de access

 
Vista:

Informe de access

Publicado por Danilo Juvinao (10 intervenciones) el 21/05/2003 22:04:31
Estoy haciendo una aplicacion con una base de datos access, y la tengo conectada por medio del compnente TADOTable.
El problema es que yo quiero imprimir o ver un reporte creado en access desde una aplicacion delphi.
Si tienen un ejemplo mucho mejor!!

De ante mano, gracias!!!!!.....
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Informe de access

Publicado por Victor (102 intervenciones) el 22/05/2003 00:27:20
Fijate en este código:

procedure TForm1.Button1Click(Sender: TObject);
begin
// open the Access application
try
Access := GetActiveOleObject('Access.Application');
except
Access := CreateOleObject('Access.Application');
end;
Access.Visible := True;

// open the database
//The second parameter specifies whether you want to open the
//database in Exclusive mode
Access.OpenCurrentDatabase(edit1.text, True);

// open the report
{The value for the second parameter should be one of
acViewDesign, acViewNormal, or acViewPreview. acViewNormal, which is the default, prints the report immediately. If you are not using the type library, you can define these values like this:

const
acViewNormal = $00000000;
acViewDesign = $00000001;
acViewPreview = $00000002;

The third parameter is for the name of a query in the current
database. The fourth parameter is for a SQL WHERE clause - the string must be valid SQL, minus the WHERE.}

Access.DoCmd.OpenReport('Consulta2', acViewPreview,
EmptyParam, EmptyParam);

//<...>
// close the database
end;

Siendo Edit1.text la ruta completa del archivo de base de datos y Consulta2 el nombre del reporte.

En el uses tenes que declarar algunas unidades, no me acuerdo cuales, pero probá con OleServer, Access97, oleauto.

Espero que te sirva
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar