Attribute VB_Name = "Module1"
Option Explicit
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset

Sub main()
    With cn
        'for ms access
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Sample.mdb;Persist Security Info=False"
        
        
        'For sql server
        '.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Information;Data Source=ANNEXSERVER"
        
        
        .CursorLocation = adUseClient
        .Open
    End With
    Form1.Show
End Sub
