This is my connection sub:
Sub InitDBConnect()
Dim ConnectDB As ADODB.Connection
Dim strDBPath As String
Dim rst As ADODB.Recordset
strDBPath = "X:\Operations\Manufacturing\Root Cause Analysis\RCAdbBE1.mdb"
' Initialize Connection object
Set ConnectDB = New ADODB.Connection
' Specify Microsoft Jet 4.0 Provider and then open the
' database specified in the strDBPath variable.
With ConnectDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
'*** Where code for data would go if not in Sub ***
End With
Set rst = New ADODB.Recordset
rst.Open _
Source:=RCAData, _
ActiveConnection:=ConnectDB, _
CursorType:=adOpenDynamic
'*** Where close and reset would go if not in Sub ***
End Sub
I call this in various subs, then close it at the end of the sub. Any help would be greatly appreciated. Should I be passing the recordset to the other sub? I am completely at a loss here and fear that I am in over my head.