Dear Master(s),
I want to merge 2 database file into 1 database :
I want to merge D:\DepositData.xlsx and D:\DepositData.xlsx1 so after I syn it, I can see all data from both database. Thanks in advance all masters.
I want to merge 2 database file into 1 database :
Code:
Sub SyncFromDatabase()
Application.ScreenUpdating = False
LastLocalChange = Sheet1.Range("B12").Value
DbFile = "D:\DepositData.xlsx" 'Customer Database Location
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error GoTo FileMissing
Set objFile = objFSO.GetFile(DbFile)
If objFile.DateLastModified > LastLocalChange Then 'Database Change was made, update Local Database
'Check Last Database Update
Sheet2.Range("A2:P9999").ClearContents 'Clear existing data
On Error Resume Next
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & "D:\DepositData.xlsx" & ";Extended Properties=""Excel 12.0 Xml;HDR=Yes;IMEX=0"";"
objRecordset.Open "Select * FROM [ShptDb$]", objConnection
Sheet2.Range("A2").CopyFromRecordset objRecordset
objRecordset.Close
objConnection.Close
End If
Exit Sub
FileMissing:
MsgBox "Please browse for the database file"
BrowseForFile
End Sub
I want to merge D:\DepositData.xlsx and D:\DepositData.xlsx1 so after I syn it, I can see all data from both database. Thanks in advance all masters.