Problem with connection and QueryDef

checoturco

Registered User.
Local time
Today, 14:13
Joined
Oct 17, 2005
Messages
76
Hi list,

i´m having a problem with querydef and connections.

i have a function with th path for my database and in the load form i call this function to create a connection

'this is the code
Dim cnch3 As ADODB.Connection
Set cnch3 = New ADODB.Connection
cnch3.Mode = adModeReadWrite
cnch3.Open strConnection


what´s happend is that a need make transactions(commit and rollback).
I read in this forum that i can´t make commit and rollback if i use the docmd command, so
i try change my code to querydefs as sugest.

well, i solve the problems for docmd command with the code below:

Dim SQL As String
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdftemp As QueryDef
Dim qdfimpsuct As QueryDef

Set ws = DBEngine.Workspaces(0)
Set db = CurrentDb

ws.BeginTrans


i don´t know if is a good idea have ADO and ADOBD...i think no

The problem happens when i try use RecordeSets,


Set qdftemp = db.CreateQueryDef("")
With qdftemp
.Connect = '<i can´t the connection works>
.SQL = "select * from tempsuct where status='CONF';"
Set rs1 = .OpenRecordset()
End With


i can't get the connection works for this code.
all the help in windows make reference to DAO and create an ODBC with DSN but i can´t get this works

My questions are:
it´s possible use querydefs (with RecordSets) and adoBD connections and use commit and rollback?

if yes, please how can make the above recordset connection work?

if someone have other ideas to make commit and rollbaks(the aim of my post) i really appreciate

tks all guys

checo
 

Users who are viewing this thread

Back
Top Bottom