Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COPY TABLE FROM UNPROTECTED DATABASE INTO PROTECTED DATABASE

Status
Not open for further replies.

pelagic

Programmer
Nov 7, 2002
97
US
Hi there
I have 2 Access 2000 databases DB1.mdb and DB2.mdb
DB1.mdb is unprotected, but DB2.mdb is protected with password. The password is "mypassword".

In DB1.mdb there is a table named table1 and in
DB2.mdb there is a table named table2.

I would like to copy all data from table1 in DB1.mdb into
table2 in DB2.mdb

Is there a way to do this?
I have tried many different ways but it doesnot work.

This is what I have in VB:
Dim strPathtoDB1 As String 'path to database
Dim strPathtoDB2 As String
Dim cn1 As ADODB.Connection
Dim cn2 As ADODB.Connection
Set cn1 = New Connection
Set cn2 = New Connection

strPathtoDB1 = App.Path & "\DB1.mdb" 'unprotected database
cn1.CursorLocation = adUseClient
cn1.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPathtoDB1

strPathtoDB2 = App.Path & "\DB2.mdb" 'protected database
cn2.CursorLocation = adUseClient
cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB2 & _
";Jet OLEDB:Database Password=mypassword"

cn1.Execute "INSERT INTO table2 IN DB2.mdb SELECT * FROM table1"

Thanks in advance,
pel
 
Hi,
You would be better off asking VENDOR specific questions in the Database Forum dedicated to that VENDOR. The ANSI SQL Forum is a VENDOR NEUTRAL Forum for questions about how to write your SQL to work with MULTIPLE vendors.


for ACCESS you might want to try....

Microsoft: Access Tables and Relationships Forum
forum700
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top