Dim tmpac As New ADODB.Connection dim tmprs as new adodb.recordset With ac_Print If ac_Print.State = adStateOpen Then ac_Print.Close .ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\aa.mdb;Mode=ReadWrite;Persist Security Info=False" .Open End WithIf tmprs.State = adStateOpen Then tmprs.Close tmprs.Open "select * from tablename", tmpac, adOpenKeyset, adLockReadOnly
dim tmprs as new adodb.recordset
With ac_Print
If ac_Print.State = adStateOpen Then ac_Print.Close
.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\aa.mdb;Mode=ReadWrite;Persist Security Info=False"
.Open
End WithIf tmprs.State = adStateOpen Then tmprs.Close
tmprs.Open "select * from tablename", tmpac, adOpenKeyset, adLockReadOnly