Nikhildhar
35 pts. | Aug 28 2009 1:23PM GMT
Thanks a lot Randym.
It really helped me
But still I m facing one more issue. Let me explain it with my code.
This is the code I have written.
Private AccApp As New Access.Application
Private Sub Command1_Click()
AccApp.NewCurrentDatabase (”C:TempMS_Access_DB_TestNewdb2.mdb”)
AccApp.DoCmd.TransferDatabase acLink, “ODBC Database”, “ODBC;DSN=DSNname;UID=user;PWD=password;”, acTable, “prod.quality”, “Linked_Table”, , True
AccApp.DoCmd.RunSQL (”Select * into NewTab from Linked_Table”)
AccApp.DoCmd.DeleteObject acTable, “Linked_Table”
AccApp.CloseCurrentDatabase
End Sub
This is working absolutely fine.
But if i m changing TransferDatabase to
AccApp.DoCmd.TransferDatabase acLink, “ODBC Database”, “ODBC;DSN=DSNname;UID=user;PWD=password;”, acQuery, “Select * from prod.quality where id = ‘102′ “, “Linked_Table”, , True
I m getting following Error here:
Run-time error ‘3146′
ODBC–call failed.
[Microsoft][ODBC driver for Oracle]Invalid string or buffer length (#0)
I hope you or anyone here has any resolution for this problem.
If I wont get any solution for this then i have to create a work table for the select query in oracle which i want to avoid.
Randym
1410 pts. | Aug 28 2009 9:32PM GMT
acQuery is probably not valid with acLink . You can only link tables. You could create a view in Oracle rather than a work table and link to the view. if ‘102′ is the criteria at all times. If that is not the case, you could create a pass through query that returns records. You can create the SQL code for the pass through query and use that in the TransferDatabase method.
Dim qd As QueryDef
Set qd = CurrentDb().CreateQueryDef(”Linked_Table”)
qd.sql = “select * from prod.quality where id = ‘102′”
qd.ReturnsRecords = True
qd.Connect = [ConnectString]
Randym
1410 pts. | Aug 28 2009 9:45PM GMT
I meant to say use the pass through query in the RunSQL statement. Not the transferdatabase method. Put the CreateQueryDef method inplace of the TransferDatabase method.






