dim cn As ADODB.Connection dim rs As ADODB.Recordset Private Sub SQLOLEDBConnect() Set cn = New ADODB.Connection MousePointer = vbHourglass ' Use the global connection object - cn ' Connect using the OLE DB provider for SQL Server - SQLOLEDB cn.ConnectionString = "provider=microsoft.jet.oledb.4.0" cn.Open "C:\XX.mdb" MousePointer = vbDefault
End Sub Private Sub KeysetRecordset(SstrSQL As String)
Set rs = New ADODB.Recordset Screen.MousePointer = vbHourglass With rs Set .ActiveConnection = cn .CursorType = adOpenStatic .LockType = adLockReadOnly .CursorLocation = adUseClient .Open SstrSQL End With Screen.MousePointer = vbDefaultEnd Sub
dim rs As ADODB.Recordset
Private Sub SQLOLEDBConnect()
Set cn = New ADODB.Connection
MousePointer = vbHourglass ' Use the global connection object - cn
' Connect using the OLE DB provider for SQL Server - SQLOLEDB
cn.ConnectionString = "provider=microsoft.jet.oledb.4.0"
cn.Open "C:\XX.mdb"
MousePointer = vbDefault
End Sub
Private Sub KeysetRecordset(SstrSQL As String)
Set rs = New ADODB.Recordset
Screen.MousePointer = vbHourglass
With rs
Set .ActiveConnection = cn
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.Open SstrSQL
End With
Screen.MousePointer = vbDefaultEnd Sub