On Error Resume Next
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim SQLZ As String
Set db = CurrentDb
SQLZ = "SELECT PRODUCTS_TBL.DATE_PROCESS, PRODUCTS_TBL.FILE_NUMBER, PRODUCTS_TBL.DILER, PRODUCTS_TBL.ORDER_NUMBER, PRODUCTS_TBL.POZITION, PRODUCTS_TBL.WIDTH_P, PRODUCTS_TBL.HEIGHT_P, PRODUCTS_TBL.TIP_PROFILS, PRODUCTS_TBL.COMMENT, PRODUCTS_TBL.DATE_OTK, PRODUCTS_TBL.ZONA_BUFER, PRODUCTS_TBL.CELL, PRODUCTS_TBL.OUT_PRODUCT, PRODUCTS_TBL.NAKLADNAYA_NUMBER, PRODUCTS_TBL.CHIP_PRODUCTS, PRODUCTS_TBL.DATE_OUT, PRODUCTS_TBL.OLD_PRODUCTS, PRODUCTS_TBL.VES_P, PRODUCTS_TBL.DATE_RECORDS, PRODUCTS_TBL.KONFIGURATION, PRODUCTS_TBL.TELEPORT_PRODUCT " _
& " FROM PRODUCTS_TBL " _
& " ORDER BY PRODUCTS_TBL.DATE_PROCESS DESC , PRODUCTS_TBL.ORDER_NUMBER, PRODUCTS_TBL.POZITION;"
'
With db
.QueryDefs.Delete ("ALL_PRODUCTS_QUE_1")
On Error GoTo Error_Handler
Set qdf = .CreateQueryDef("ALL_PRODUCTS_QUE_1", SQLZ)
End With
db.QueryDefs.Refresh
SQLZ = "ALL_PRODUCTS_QUE_1"
DoCmd.OpenQuery SQLZ, acNormal, acReadOnly
Error_Handler_Exit:
On Error Resume Next
Set qdf = Nothing
Set db = Nothing
Exit Sub
Error_Handler:
MsgBox "Ошибочка" & vbCrLf & vbCrLf & "Error Number: "
Resume Error_Handler_Exit
|