Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2006, 07:38 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Export to oracle

Hi!!
I want to transfer a table from access 2003 to an oracle table.
i tried this code "DoCmd.TransferDatabase acLink, "ODBC Database", "ODBC;DSN=tttt;DBQ=dddd;DATABASE=bbbb", acTable, "TEST"", but it doesn't work. it retrieves me an run time error 2507 and says that i don't have the ODBC databases type installed!
i can do this from clicking with the right bottom on the table name export>ODBC databases>.. but i need to do it from a form!
is it possible to open this export window using vba code?
Thanks a lot

 
Old January 31st, 2006, 01:10 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I think you want "DoCmd.TransferDatabase acExport...

HTH


mmcdonal
 
Old February 2nd, 2006, 08:16 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i tried but it doesn't work as well..

 
Old February 2nd, 2006, 08:21 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

After rereading your first post, perhaps you want to create a button on a form (don't use the button wizard) and put this code on the button.

Perhaps if you browse MSDN online for this issue...

I also found this post:
Dim db As DATABASE
Dim rs As Recordset
Dim retval As Variant

Dim DSNName As String, DSNUser As String, DSNPassword As String
retval = SysCmd(1, "Connection Oracle...", 16)

DSNName = "" 'fill those 3 next lines
DSNUser = ""
DSNPassword = ""


On Error GoTo Event_Err

retval = SysCmd(2, 4)
DoCmd.TransferDatabase acLink, "ODBC", "ODBC;DSN=" & DSNName & ";UID=" & DSNUser & ";PWD=" & DSNPassword & ";DBQ=edr1;DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;L OB=T;RST=T;FRL=F;MTS=T;CSR=F;PFC=10;TLO=0;;TABLE=C RJDACTDATA.TBL_EXPORT", acTable, "CRJDACTDATA.TBL_EXPORT", "Test1", False
DoCmd.DeleteObject acTable, "Test1"
retval = SysCmd(2, 16)
retval = SysCmd(3)

Event_Exit:
Exit Function

Does this help?


mmcdonal
 
Old February 2nd, 2006, 11:09 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Its almost done!!
i can export the table now but i can do it just once!! at the second time i got the error 3146 but if i change the oracle table name i can do it!
Is it possible to delete an oracle table from access using vba?
thanks

 
Old February 2nd, 2006, 11:25 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

It makes sense that you can do it only once since you are creating a table. How about doing an append query instead?


mmcdonal
 
Old February 2nd, 2006, 11:35 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i tried as well but i'm not able to link the query with the oracle database!!
any suggestion?

thanks for the help

 
Old February 2nd, 2006, 12:33 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

DoCmd.DeleteObject acTable... ?




mmcdonal
 
Old February 2nd, 2006, 12:41 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry, I don't know what I was thinking.

Open a recordset on the table, and do...

rs.AddNew
...
rs.Update or UpdateBatch

Also, open a recordset on the table with the following sql statement:

DELETE * FROM tblYourTable"

Failing that, how about switching to SQL Server? I know it doesn't perform quite as well in some areas, but it costs 1,000 times less!

=)

mmcdonal
 
Old February 2nd, 2006, 12:56 PM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i solved the problem with an append query.

thanks for the help






Similar Threads
Thread Thread Starter Forum Replies Last Post
call oracle function using oracle link server vl SQL Server 2000 1 July 12th, 2007 08:19 AM
export crystal report with oracle db in VB g-mey Pro VB Databases 0 February 8th, 2005 12:28 AM
Export Oracle 8 - >> Access 2K wwwdirzala Pro VB 6 0 August 23rd, 2004 03:30 AM
Using export and import tool for Oracle pankaj_daga Oracle 1 June 23rd, 2004 11:04 AM
Import/Export Wizard for Oracle 9i, Need Help!!! tarivs ADO.NET 0 January 18th, 2004 04:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.