Hi,
Because many users use my database, I would like to optimize my program. I would like users to connect to the database for a moment, receive certain records (listbox), and then the connection would close. I did it with an ADO code, but I can not deal with DAO, which works faster. In the DAO code, the listbox populates, only when I don't close the recordset / connection. Can it be changed?
DAO
Code:
Dim db As DAO.Database, Rst As DAO.Recordset, strSQL$ Set db = DAO.OpenDatabase(StrDb, dbOpenSnapshot)
Set Rst = db.OpenRecordset(strSQL)
Set Me.listBoxTest.Recordset = Rst
Rst.Close
db.Close
ADO - works
Code:
Const strConnect$ = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=" & StrDb & ";" & _
"Jet OLEDB:Database Password=" & passDb & ";"
Dim strSQL$
Dim Conn As ADODB.Connection
Dim Rst As ADODB.Recordset
Set Rst = New ADODB.Recordset
Rst.CursorType = adOpenStatic
Set Conn = CreateObject("ADODB.Connection")
Conn.CursorLocation = adUseClient
Conn.Open strConnect
Rst.Open strSQL, Conn, adOpenStatic, adLockReadOnly
Set Me.listBoxTest.Recordset = Rst
Rst.Close
db.Close
andrews
--
Sorry form my English