Conection using ADO, Code from Global Module: -
Public g_adoCnn As New ADODB.Connection
Public Function DBConnect() As Boolean
'* Purpose : Connect to Database.
g_adoCnn.ConnectionString = "Provider=MSDAORA;Password=password;User ID=user;Data Source=dbsource"
g_adoCnn.Open
End Function
Public Sub DBDisconnect()
'* Purpose : Disconnect from Database.
g_adoCnn.Close
End Sub
Form Code: -
Option Explicit
Private Sub Form_Initialize()
DBConnect
End Sub
Private Sub Form_Unload(Cancel As Integer)
DBDisconnect
End Sub
Hope this helps?
Regards