need help

  • Thread starter Thread starter siagian
  • Start date Start date
S

siagian

Set db = CurrentDb
Set qdfReport = db.CreateQueryDef("", _
"PARAMETERS tgl_awal DateTime, tgl_akhir
DateTime; " & _
"SELECT [tblWO].[no_wo], [tblWO].[masuk_tgl],
[tblDataKendaraan].[no_pol], [tblDataPemilik].
[perusahaan], [tblWO].[no_wo] AS wo " & _
"FROM tblDataPemilik RIGHT JOIN (tblDataKendaraan
RIGHT JOIN tblWO ON [tblDataKendaraan].[nokey_cu]=[tblWO].
[nokey_cu]) ON [tblDataPemilik].[IDCU]=[tblDataKendaraan].
[IDCU]" & _
" WHERE ((([tblWO].[masuk_tgl]) Between [tgl_awal]
And [tgl_akhir])) " _
& " ORDER BY [tblWO].[masuk_tgl], [tblWO].[no_wo]")

qdfReport.Parameters!tgl_awal = Me.awal
qdfReport.Parameters!tgl_akhir = Me.akhir

With qdfReport
' Open Recordset from QueryDef.
Set rs = .OpenRecordset(dbOpenSnapshot)
With rs
Set Me.Recordset = rs
End With
End With

Data 30000 record each table

why at first time slow ??

thanks
 
why at first time slow ??

It's a three-table join and has to be compiled. What is the reason for
creating a new querydef rather than storing it and just calling it? That
way, it's already compiled and Jet won't have to work out how to run it
each time.

HTH


Tim F
 
Back
Top