Option Explicit

'This here is a example from a Sportsligue program
'Create always in your program a module (mdlStartProgram)
'and from there start your program

Public DB As ADODB.Connection
Public rsLigue As ADODB.Recordset
Public rsTeams As ADODB.Recordset
Public rsResults As ADODB.Recordset

Sub Main()
Dim strProvider As String 'name the database provider
Dim strDataSource As String 'let the system know what data source to search in for the database
Dim strDataBaseName As String 'name of the database
Dim strPassword As String 'password, if the DB is protected
Dim strConnect As String

    'Check that the Program isnt already running
    If App.PrevInstance Then
    MsgBox "The Program is already running!"
    End
    End If

strProvider = "Provider= Microsoft.Jet.OLEDB.3.51;"
'If you use Access2000 then use 4.0
'strProvider = "Provider= Microsoft.Jet.OLEDB.4.0;"
strDataSource = App.Path
strDataBaseName = "\PairingSystem.mdb;"
strPassword = ""
strDataSource = "Data Source=" & strDataSource & strDataBaseName & strPassword
strConnect = strProvider & strDataSource

Set DB = New ADODB.Connection
DB.Open strConnect

Set rsLigue = New ADODB.Recordset
rsLigue.CursorType = adOpenStatic
rsLigue.CursorLocation = adUseClient
rsLigue.LockType = adLockPessimistic
rsLigue.Source = "Select * From [Ligue]"
rsLigue.ActiveConnection = DB
rsLigue.Open

'a example to open DBF-files
Set DBF = New ADODB.Connection
'Unfortunatly it needs the correct position, but with AppPath is this to shortcut
DBF.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & "DriverID=277;" & "Dbq=c:\projects2002\vbasic\abd2002;"

Set rsDBFdata = New adodb.Recordset
rsDBFdata.Open "Select * From MyCostomers.dbf", DBF, adOpenDynamic, adLockPessimistic, adCmdText


'now show the Mainform
frmMainform.Show

End Sub

Sub EndProgram()
Dim frm As Form

    For Each frm In Forms
    Unload frm
    Next frm

End

End Sub
