ADODB.Recordset as FORM.RecordSet

  • Thread starter Trygve Lorentzen
  • Start date
T

Trygve Lorentzen

Hi,

I have tried without luck to set a forms Recordset property runtime to a
ADODB.Recordset object. I'm running an Access DB connected via ODBC to a
MySQL database and would like to be able to use updateable recordsets that
are not Jet Recordsets in my forms to increase performance... Is what I'm
trying to do possible? Are there other ways I can increase performance? With
reports it is all fine because I can just use pass-through queries since I
don't need updatable recordsets here. Below is some sample code...


I took some code from the Access file:
-----------------------------------------------
Global rstSuppliers As ADODB.Recordset
Sub MakeRW()
DoCmd.OpenForm "Suppliers"
Set rstSuppliers = New ADODB.Recordset
rstSuppliers.CursorLocation = adUseClient
rstSuppliers.Open "Select * From Suppliers", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Forms("Suppliers").Recordset = rstSuppliers
End Sub
-----------------------------------------------

and modified into this:

-----------------------------------------------
Global rstTvinnSupport As ADODB.Recordset
Global gConn As ADODB.Connection
Sub OpenTvinnSupport()
Dim sql As String

DoCmd.OpenForm "Tvinn_support"
Set gConn = New ADODB.Connection
gConn.ConnectionString = "DSN=procom_server"
gConn.Open

sql = "..."

Set rstTvinnSupport = New ADODB.Recordset
rstTvinnSupport.CursorLocation = adUseClient
rstTvinnSupport.Open "sql, gConn, adOpenKeyset, adLockOptimistic"
Set Forms("Tvinn_support").Recordset = rstTvinnSupport
End Sub
-----------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top