Ask a Question related to Microsoft Access, Design and Development.
-
R.Kisoenpersad #1
import excel
hi,
Have several excel files in a folder. want to import them all at once
(ofcource if it can automatically)
they all have 2 sheets (open and Closed)
they all have at line 6 the header (both sheets)
they all have data started at line 7 (both sheets)
how can I import these excel files into access?
Kisoen
R.Kisoenpersad Guest
-
How can I import an excel spreadsheet into SQL?
I'm having a hard time finding info on how to do this. Does anyone have any examples, without purchasing a custom tag, on how to do this? -
import from excel
Goal: How to import data from an excel file to an oracle or access db. Help needed. tc -
Exporting and Import Excel
OK, So on my website, I want to allow the user to download an Excel Spreadsheet and update it, then reupload it. For download, I have it... -
Need to Import Excel Graphs - ID2
I've found info on how to import spread sheets, BUT I need to import charts/graphs created in Excel. What is the best way to accomplish this? I don't... -
Need to import data to excel
Is there a way to import the data in xml file to excel spreadsheet as well as provide required formatting on the data. I have excel 2000. Thanks... -
Tom Youngquist #2
import excel
Kisoen,
Below is a sample set of code which opens an excel file in
OfficXP, reads lines, puts data in an access table, then
closes the spreadsheet. To use it for your purposes you
could put some of the code in a loop which opens the table
recordset first, then loops through each spreadsheed
opening them and reading the data into the table, the
close everything and get out. I hope it helps.
Tom
Dim rst As Recordset
Dim intLineCounter As Integer
Dim intBlankCounter As Integer
Dim oApp As Excel.Application
Dim strCheck As String
Dim strSQL As String
' ctl_ImportFileName has the Excel spreadsheet file name
strCheck = Dir$(ctl_ImportFileName)
If strCheck = "" Then
MsgBox "Can't find file '" & ctl_ImportFileName _
& ".' Please check location of the file you wish " _
& "to import, and try again."
GoTo Exit_btn_CallsImport_Click
End If
' The following sets up the records set which will be
' added to.
strSQL = "Select * From tblCalls " _
& "Where callDate = #" & ctl_CallDate & "#"
DoCmd.SetWarnings False
DoCmd.Hourglass True
Set rst = CurrentDb.OpenRecordset(strSQL)
Set oApp = New Excel.Application
oApp.Workbooks.Open FileName:=ctl_ImportFileName
oApp.Visible = True
intLineCounter = 1
intBlankCounter = 0
Do Until intBlankCounter = 4
intLineCounter = intLineCounter + 1
oApp.Cells(intLineCounter, 1).Select
If oApp.Selection = "" Then
intBlankCounter = intBlankCounter + 1
GoTo NextLoop
End If
' The blank counter allows me to loop till I have found
' 3 blank lines in a row. You can change this logic
' to be from line to line, whatever works for you.
intBlankCounter = 0
If Not IsDate(oApp.Selection) Then GoTo NextLoop
rst.AddNew
rst!callDate = oApp.Cells(intLineCounter, 1)
rst!callTime = oApp.Cells(intLineCounter, 2)
rst!callState = oApp.Cells(intLineCounter, 3)
rst!callStation = oApp.Cells(intLineCounter, 5)
rst!callLogDate = ctl_LogDate
rst!callException = 0
rst.Update
NextLoop:
Loop
oApp.Quit
Set oApp = Nothing
rst.Close
Set rst = Nothing
Exit_btn_CallsImport_Click:
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub
Err_btn_CallsImport_Click:
MsgBox Err.Number & "-" & Err.Description, vbCritical
Resume Exit_btn_CallsImport_Click
all at once>-----Original Message-----
>hi,
>Have several excel files in a folder. want to import them>(ofcource if it can automatically)
>
>they all have 2 sheets (open and Closed)
>they all have at line 6 the header (both sheets)
>they all have data started at line 7 (both sheets)
>
>how can I import these excel files into access?
>Kisoen
>
>
>.
>Tom Youngquist Guest



Reply With Quote

