G
George
Hello to everybody....
After hours of searching (and a lot of headache)
i really would appreciate some help....
In the following code example anything works
properly ONLY IF Table1 is a table in a
..mdb file (local or attached).
If Table1 is an ODBC-Linked Table programm
execution stops at line (11) and after the ODBC-
timeout expires i get the message:
"ODBC-Call failed."
Why is this happening only with
ODBC-Linked tables ????
1 Dim myws As Workspace, mydb As Database, mydef As QueryDef
2 Dim myset1 As Recordset
3 Set myws = DBEngine.Workspaces(0)
4 Set mydb = CurrentDb()
5 Set mydef = mydb.QueryDefs("query1")
6 '===activate the next line only if table1 is an ODBC-Linked Table
7 '===mydef.Connect =
"ODBC;DATABASE=test_unidata;UID=sa;PWD=;DSN=test_unidata"
8 myws.BeginTrans
9 mydef.SQL = "INSERT INTO table1 (c1) VALUES ('George')"
10 mydef.Execute
11 Set myset2 = mydb.OpenRecordset("table1", dbOpenDynaset, dbSeeChanges)
12 myset2.MoveLast
13 MsgBox "" & myset2("c1")
14 myws.CommitTrans
Thousand Thanks in advance
George
After hours of searching (and a lot of headache)
i really would appreciate some help....
In the following code example anything works
properly ONLY IF Table1 is a table in a
..mdb file (local or attached).
If Table1 is an ODBC-Linked Table programm
execution stops at line (11) and after the ODBC-
timeout expires i get the message:
"ODBC-Call failed."
Why is this happening only with
ODBC-Linked tables ????
1 Dim myws As Workspace, mydb As Database, mydef As QueryDef
2 Dim myset1 As Recordset
3 Set myws = DBEngine.Workspaces(0)
4 Set mydb = CurrentDb()
5 Set mydef = mydb.QueryDefs("query1")
6 '===activate the next line only if table1 is an ODBC-Linked Table
7 '===mydef.Connect =
"ODBC;DATABASE=test_unidata;UID=sa;PWD=;DSN=test_unidata"
8 myws.BeginTrans
9 mydef.SQL = "INSERT INTO table1 (c1) VALUES ('George')"
10 mydef.Execute
11 Set myset2 = mydb.OpenRecordset("table1", dbOpenDynaset, dbSeeChanges)
12 myset2.MoveLast
13 MsgBox "" & myset2("c1")
14 myws.CommitTrans
Thousand Thanks in advance
George