- Module Access2
- Dim soft As Access.Application
- Dim ouvert As Boolean = False
-
- Public Sub impression(ByVal nom As String, Optional ByVal Acview As Access.AcFormView = Access.AcFormView.acPreview, Optional ByVal filtre As String = "", Optional ByVal where As String = "")
- ouvrirAccess()
- Try
- soft.DoCmd.OpenReport(nom, Acview, filtre, where)
- soft.DoCmd.Maximize()
- Catch
- End Try
- End Sub
-
- Public Sub executerCode(ByVal code As String, ByVal arg1 As String)
- ouvrirAccess()
- Try
- soft.Run(code, arg1)
- Catch
- End Try
- End Sub
-
- Public Sub executerCode(ByVal code As String, ByVal arg1 As String, ByVal arg2 As String)
- ouvrirAccess()
- Try
- soft.Run(code, arg1, arg2)
- Catch
- End Try
- End Sub
-
- Public Sub executerCode(ByVal code As String)
- ouvrirAccess()
- soft.Run(code)
- End Sub
-
- Public Sub fermeture()
- On Error Resume Next
- soft.CloseCurrentDatabase()
- soft.Quit()
- soft = Nothing
- End Sub
-
- Public Sub ouvrirAccess()
- Dim temp As String
- Try
- temp = soft.CurrentDb.Version
- Catch
- If Not ouvert Then
- soft = New Access.Application
- soft.Visible = True
- ouvert = True
- End If
- soft.OpenCurrentDatabase("C:\projet.mdb")
- End Try
- End Sub
- End Module
Module Access2
Dim soft As Access.Application
Dim ouvert As Boolean = False
Public Sub impression(ByVal nom As String, Optional ByVal Acview As Access.AcFormView = Access.AcFormView.acPreview, Optional ByVal filtre As String = "", Optional ByVal where As String = "")
ouvrirAccess()
Try
soft.DoCmd.OpenReport(nom, Acview, filtre, where)
soft.DoCmd.Maximize()
Catch
End Try
End Sub
Public Sub executerCode(ByVal code As String, ByVal arg1 As String)
ouvrirAccess()
Try
soft.Run(code, arg1)
Catch
End Try
End Sub
Public Sub executerCode(ByVal code As String, ByVal arg1 As String, ByVal arg2 As String)
ouvrirAccess()
Try
soft.Run(code, arg1, arg2)
Catch
End Try
End Sub
Public Sub executerCode(ByVal code As String)
ouvrirAccess()
soft.Run(code)
End Sub
Public Sub fermeture()
On Error Resume Next
soft.CloseCurrentDatabase()
soft.Quit()
soft = Nothing
End Sub
Public Sub ouvrirAccess()
Dim temp As String
Try
temp = soft.CurrentDb.Version
Catch
If Not ouvert Then
soft = New Access.Application
soft.Visible = True
ouvert = True
End If
soft.OpenCurrentDatabase("C:\projet.mdb")
End Try
End Sub
End Module