Re: SELECT INTO an external database
- From: Rich P <rpng123@xxxxxxx>
- Date: 31 Aug 2007 16:39:22 GMT
Greetings,
Here is another way to manipulate data to/from an External Database
using ADO:
Dim cmd As New ADODB.Command, RS1 As New ADODB.Recordset
Dim strConn As String
strConn = "Provider =Microsoft.Jet.OLEDB.4.0; " _
& " Persist Security Info=false;" _
& "Data Source=C:\someDir\ExternalDB.mdb"
cmd.ActiveConnection = strConn
cmd.CommandType = adCmdText
cmd.CommandText = "Insert Into yourExternalTbl(fld1, fld2, fld3) Select
'test1', 'test2', 'test3'"
cmd.Execute
cmd.ActiveConnection.Close
Here the example assumes there is a table called yourExternalTbl with 3
text fields called fld1, fld2, fld3
ADO can't do bulk inserts to an External DB, only row by row. You can
also use an ADODB Recordset object, but the command object is more
efficient and easier to use. For Bulk Insert to an External DB from
Access use
DoCmd.RunDql "Insert Into yourExternaltbl In 'C:\someDir\ExternalDB.mdb'
Select * from yourLocalTbl"
Rich
*** Sent via Developersdex http://www.developersdex.com ***
.
- References:
- SELECT INTO an external database
- From: stebain
- SELECT INTO an external database
- Prev by Date: Changing backcolor
- Next by Date: Re: Blank Forms
- Previous by thread: Re: SELECT INTO an external database
- Next by thread: Performing a SELECT INTO an external database
- Index(es):
Relevant Pages
|