Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question MSDE: Query Analyzer vs MSAccess ADP

Status
Not open for further replies.

koci

Programmer
Oct 3, 2005
5
0
0
ES
Hi all!

I have one UDF which take 5 params. When I run this UDF from Query Analyzer (select * from dbo.UDFname (param1, ..., param5)), it take 5 seconds, but when I run from ADP project (doble click), it take > 200 seconds. In both situations I obtain the same result (of course). I look at the connexion, seems ok (File -> Connexion; in .adp).

Can anybody tell me why are this differences? And how to surpass this ? I want to use the access .adp to make one front to run a MSDE db.

Thank's in advance :)

koci.
 
Ok, partially I solved the problem, but still have a question:

The difference between this two tools:

1. In QA: select * from CInventarioAFechaPaso7Agrupar ('01/01/06',1,10000,0,0,0)
2. In ADP: Report.ControlSource = CInventarioAFechaPaso7Agrupar
Report.InputParameters = @FechaInventario datetime = Forms!PIInventario!FechaInventario, @DesdeFabricante int = Forms!PIInventario!DesdeProveedor, @HastaFabricante int = Forms!PIInventario!HastaProveedor, @IDFamilia smallint = Forms!PIInventario!IDFamilia, @IDMarca smallint = Forms!PIInventario!IDMarca, @IDTienda smallint = Forms!PIInventario!IDTienda

When I change the reports control source at:

select * from CInventarioAFechaPaso7Agrupar ('01/01/06',1,10000,0,0,0)

and clean InputParameters, everything works OK, like in QA (of the time point of view, of course), so, no difference.

So far, so good.

But if I want to put params in the reports control source, like:

SELECT * FROM CInventarioAFechaPaso7Agrupar(@FechaInventario, @DesdeFabricante, @HastaFabricante, @IDFamilia, @IDMarca, @IDTienda)

the InputParameters it's change in

? = FechaInventario, ? = DesdeFabricante, ? = HastaFabricante, ? = IDFamilia, ? = IDMarca, ? = IDTienda

And If I edit this line, changing in:

@FechaInventario datetime = Forms!PIInventario!FechaInventario, @DesdeFabricante int = Forms!PIInventario!DesdeProveedor, @HastaFabricante int = Forms!PIInventario!HastaProveedor, @IDFamilia smallint = Forms!PIInventario!IDFamilia, @IDMarca smallint = Forms!PIInventario!IDMarca, @IDTienda smallint = Forms!PIInventario!IDTienda

the line is change back in:

? = FechaInventario, ? = DesdeFabricante, ? = HastaFabricante, ? = IDFamilia, ? = IDMarca, ? = IDTienda

and I have no way to avoid the manual introduction of params, to run the report.


Any explications for this? A workaround, something?

Thank's,

koci.

PS. The way that I use (and work) is assigning in code, in the reports open event, something like following:

Dim MiSQL As String

MiSQL = "select * from CInventarioAFechaPaso7Agrupar ('" & Forms!PIInventario!FechaInventario & "'," & _
Forms!PIInventario!DesdeProveedor & "," & Forms!PIInventario!HastaProveedor & "," & _
Forms!PIInventario!IDFamilia & "," & Forms!PIInventario!IDMarca & "," & Forms!PIInventario!IDTienda & ")"
Debug.Print MiSQL

Me.RecordSource = MiSQL

but this is not very elegant, because can't see the field list, for an quick development of report.

----------------------------------------------------------------------------------------------------------------------------------------


Ok, partially I solved the problem, but still have a question:
The difference between this two tools:
1. In QA:
select * from CInventarioAFechaPaso7Agrupar ('01/01/06',1,10000,0,0,0)
2. In ADP:
Report.ControlSource = CInventarioAFechaPaso7Agrupar
Report.InputParameters = @FechaInventario datetime = Forms!PIInventario!FechaInventario, @DesdeFabricante int = Forms!PIInventario!DesdeProveedor, @HastaFabricante int = Forms!PIInventario!HastaProveedor, @IDFamilia smallint = Forms!PIInventario!IDFamilia, @IDMarca smallint = Forms!PIInventario!IDMarca, @IDTienda smallint = Forms!PIInventario!IDTienda
When I change the reports control source at:
select * from CInventarioAFechaPaso7Agrupar ('01/01/06',1,10000,0,0,0)
and clean InputParameters, everything works OK, like in QA (of the time point of view, of course), so, no difference.
So far, so good.
But if I want to put params in the reports control source, like:
SELECT * FROM CInventarioAFechaPaso7Agrupar(@FechaInventario, @DesdeFabricante, @HastaFabricante, @IDFamilia, @IDMarca, @IDTienda)
the InputParameters it's change in:
? = FechaInventario, ? = DesdeFabricante, ? = HastaFabricante, ? = IDFamilia, ? = IDMarca, ? = IDTienda
And If I edit this line, changing in:
@FechaInventario datetime = Forms!PIInventario!FechaInventario, @DesdeFabricante int = Forms!PIInventario!DesdeProveedor, @HastaFabricante int = Forms!PIInventario!HastaProveedor, @IDFamilia smallint = Forms!PIInventario!IDFamilia, @IDMarca smallint = Forms!PIInventario!IDMarca, @IDTienda smallint = Forms!PIInventario!IDTienda
the line is change back in:
? = FechaInventario, ? = DesdeFabricante, ? = HastaFabricante, ? = IDFamilia, ? = IDMarca, ? = IDTienda
and I have no way to avoid the manual introduction of params, to run the report.
Any explications for this? A workaround, something?

Thank's,

koci.

PS. The way that I use (and work) is assigning in code, in the reports open event, something like following:
Dim MiSQL As String
MiSQL = "select * from CInventarioAFechaPaso7Agrupar ('" & Forms!PIInventario!FechaInventario & "'," & _
Forms!PIInventario!DesdeProveedor & "," & Forms!PIInventario!HastaProveedor & "," & _
Forms!PIInventario!IDFamilia & "," & Forms!PIInventario!IDMarca & "," & Forms!PIInventario!IDTienda & ")"
Debug.Print MiSQL
Me.RecordSource = MiSQL
but this is not very elegant, because can't see the field list, for an quick development of report.


.
 
You could try returning the variables through public functions.

In standard module.
PubFechaInventario as date
PubDesdeFabricante as integer
etc.....
Public Function ReturnFechaInventario() as date
ReturnFechaInventario = PubFechaInventario
End Function
Public Function ReturnDesdeFabricante() as integer
ReturnDesdeFabricante = PubDesdeFabricante
End Function
etc....

In the Form where the variables are entered.
PubFechaInventario = Forms!PIInventario!FechaInventario
PubDesdeFabricante = Forms!PIInventario!DesdeProveedor
etc....

In the Record Source of the Report.
SELECT * FROM CInventarioAFechaPaso7Agrupar (ReturnFechaInventario(), ReturnDesdeFabricante(), etc, etc, etc, etc)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top