Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.
Sub Data_Transfer() Dim cn As Object '//I am using late binding for creating objects, this code will run on any version of Excel Set cn = CreateObject("ADODB.Connection") ' //This line will set the path of Ms.Access database, in this case it is assumed that Ms.Access DB will be in same folder as in Excel File. dbPath = Application.ActiveWorkbook.Path & "\SDOD.mdb" ' // This line will set the path of Active workbook dbWb = Application.ActiveWorkbook.FullName '// Get the Active sheet name, so that we can correctly Export data using this variable dbWs = Application.ActiveSheet.Name '// Set the connection, we are creating Excel workbook connection scn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath ' //Another variable to hold worksheet name, but in this case it will //be in a format that is required to pass in open connection //method, which execute the SQL statement in next line dsh = "[" & "Sheet1" & "$]" '// Open the connection cn.Open scn '//Create SQL statement using proper sheet name dsh, created //before opening connection ssql = "INSERT INTO Candidate ([Source],[C_Name])" ssql = ssql & "SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=" & dbWb & "]." & dsh '//Run the SQL cn.Execute ssql End Sub
|Excel 2013 Problem||12||44|
|Stopping execution of code while print previewing reports access 2010||24||23|
|Formula to Compare 2 Excel Worksheets If data in Worksheet 1 matches data in Worksheet 2 then copy that to Worksheet 3||9||26|
|ACCESS 2010 Can't Open accdb - Goes To Available Templates Pane||17||12|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!