Thread: Best method of access to PostgreSql using VBA in Microsoft Access

Best method of access to PostgreSql using VBA in Microsoft Access

From
"David Pinelo"
Date:
Hi!
   I'm using Access like front-end to a PostgreSQL server with ODBC... I
make a lot of select queries with visual basic code along the aplication.
What are the best access method to obtain best perfomance? Yo know, shall I
use ODBCDirect? ADO? DAO, maybe?
   For example, I have to make a select like this: "SELECT * FROM table1
WHERE id=[Forms]![Form1]!id AND aaa=value_I_obtain_in_my_vb_code", what's
the better methdo of this one?

--------------------------
Dim queryd as Querydef
Dim rst as Recordset

set queryd=cnData.CreateQueryDef("")    'cnData is a Connection to ODBC
source
queryd.SQL="SELECT ..."
set rst=queryd.OpenRecordset(dbOpenSnapshot)
----------------------------

or

Dim dbs as Database
Dim rst as Recordset

set dbs=CurrentDb()
set rst=dbs.OpenRecordset("SELECT ...")
-----------------------------------------------

And, if I want to update a record, what's the best?

this one?

rst.Edit
rst![field]=value
rst.update

or

Dim queryd as QueryDef
set queryd=cnData.CreateQueryDef("")
queryd.SQL="UPDATE..."
queryd.Execute


I have all the tables that I need, linked to mdb file.

Thank you very much


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com