Dim cp As String = "Microsoft.ACE.OLEDB.12.0;" Dim da As OleDb.OleDbDataAdapter Dim DBPath As String = "C:\....\Databases\HVT-HVTPS\DB-TEST" Dim DBName As String = "\TEST_Test_Commercial_DB.accdb" Dim ArchiveDBPath As String = "C:\..........\Databases\HVT-HVTPS\DB-TEST" Dim ArchiveDBName As String = "\TEST_Test_Archive_DB.accdb" Dim DB_FROM As String = "C:\.......\TEST_Test_Commercial_DB.accdb" Dim DB_TO As String = "C:\.......\TEST_Test_Archive_DB.accdb" Dim cnnFrom As New OleDb.OleDbConnection Dim cnnTo As New OleDb.OleDbConnection Dim strSQL As String cnnFrom.ConnectionString = "Provider=" & cp & " Data Source=" & DBPath & DBName & ";Jet OLEDB:Database Password=xyx;" cnnTo.ConnectionString = "Provider=" & cp & " Data Source=" & ArchiveDBPath & ArchiveDBName & ";Jet OLEDB:Database Password=xyz;" cnnFrom.Open() cnnTo.Open() strSQL = "INSERT INTO Archive_Purchase_Order SELECT * FROM Purchase_Order IN '" & DB_FROM & "' WHERE Po_Number = 'DD14-02-003 / 299RV'" ' ^ ' Error appears to be here (In DB_FROM) Try da.InsertCommand = New OleDbCommand(strSQL, cnnTo) da.InsertCommand.ExecuteNonQuery() 'crashes here with System.Data.OleDb.OleDbException (0x80004005): Not a valid password. Catch ex As Exception cn.Close() MsgBox(ex.ToString) Exit Sub End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)