Bonjour,
je désirais savoir si on peut ouvrir un report (état) de une commande vba Excel
je sais le faire dans le Vba Access
DoCmd.OpenReport"rptReport", acViewPreview,,"ID=" & Me.ID
mais depuis Excel ??
Depuis Excel pour faire les requêtes et update j'utilise
mais cela fonctionne uniquement sur les fonctions Select, Insert, Update, Delette,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
On Error GoTo errhdlr
Set Cnx = CreateObject("ADODB.Connection")
Cnx.Provider = "MSDASQL"
Cnx.Open "DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" & BDD
If Left(Req, 6) = "SELECT" Then
Set Rst = CreateObject("ADODB.Recordset")
Rst.Open Req, Cnx, 3
.......
Else
Cnx.Execute Req
Query = 0
End If
Cnx.Close
Set Rst = Nothing
Set Cnx = Nothing
Exit Function
errhdlr:
If Not Rst Is Nothing Then If Rst.State = 1 Then Rst.Close
If Not Cnx Is Nothing Then If Cnx.State = 1 Then Cnx.Close
Set Rst = Nothing
Set Cnx = Nothing
Query = -1
MsgBox (Err.Number & " - " & Err.Description) |
merci pour vos informations
Partager