Option Compare Database Private Sub Command3_Click() Dim xlApp As Object Dim xlWrk As Object Dim xlSheet As Object Dim i As Long Dim sql As String Set xlApp = VBA.CreateObject("Excel.Application") 'toggle visibility for debugging xlApp.Visible = False Set xlWrk = xlApp.Workbooks.Open("C:\ExcelImportFile.xls") Set xlSheet = xlWrk.Sheets("Sheet1") For i = 1 To 10 sql = "Insert Into tblTestImport (NOTE) VALUES (" & xlSheet.Cells(i, 2).Value & ")" DoCmd.RunSQL sql Next i xlWrk.Close xlApp.Quit Set xlSheet = Nothing Set xlWrk = Nothing Set xlApp = Nothing End Sub
Gain unlimited access to on-demand training courses with an Experts Exchange subscription.Get Access
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.