Import Excel Data Into Access Table
- From: Marion <Marion@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Apr 2005 08:21:07 -0700
I found the online help that explains how to import into Access all of the
data found on an Excel ***. However, I am getting all 65k rows. I want to
use an SQL statement to filter out empty rows. Below is an example of what I
want to do. I know that this does not work but I am using it to try and
communicate the basic idea.
Any help is appreciated. Thanks.
Private Sub btnImport_Click()
Dim sql As String
Dim num As Long
If lstImportList.ItemsSelected.Count > 0 Then
For Each Itm In lstImportList.ItemsSelected
'Import by using OPENROWSET and SELECT query.
sql = "SELECT * INTO TBL_IMPORT " & _
"FROM ['Excel 8.0;Database=" & lstImportList.Column(2, Itm)
& "'].['Select * From (Budget$) Where (WorkPlan_ID) <> " & Chr(38) & Chr(38)
& "']"
CurrentProject.Connection.Execute sql, num, adExecuteNoRecords
MsgBox "Records affected: " & num
Next Itm
End If
End Sub
.
- Follow-Ups:
- Re: Import Excel Data Into Access Table
- From: smitty_one_each
- Re: Import Excel Data Into Access Table
- Prev by Date: Re: client side cursor vs server side cursor regarding memory used
- Next by Date: Re: Syntax error in insert statement?
- Previous by thread: Problem with insert and update table with 150 text columns in Access
- Next by thread: Re: Import Excel Data Into Access Table
- Index(es):