copy kan script berikut ke modul koneksi
Option Explicit
Public Konek As New ADODB.Connection
Public Rsdata As New ADODB.Recordset
Public StrMyQuery As String
Public StrKonek As String
Public Sub KoneksikeDatabase()
StrKonek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\NAMADATABASE.mdb;Persist Security Info=False"
Set Konek = New ADODB.Connection
Konek.CursorLocation = adUseClient
If Konek.State = adStateOpen Then
Konek.Close
Set Konek = New ADODB.Connection
Konek.CursorLocation = adUseClient
Konek.Open (StrKonek)
Else
Set Konek = New ADODB.Connection
Konek.CursorLocation = adUseClient
Konek.Open (StrKonek)
Exit Sub
End If
End Sub
Public Function GantiPetik(teks As String) As String
GantiPetik = Replace(teks, "'", "''")
End Function
Ещё видео!