Hi All,
I'm wondering if anyone can help me.
I've written a database that imports data from various excel spreadsheets over a network daily. While the import process works okay, I'm having problems with blank lines being imported as well.
I have one of my excel files with the following:
Excel File Name: Exceptions Log
Spreadsheet Name: LogData
Total Area: A1:I50
Headers: True
With the code I currently have (see below), I have to open up the spreadsheet, find the last row of data and define that in my "area" text box on my form in access (i.e A1:I23)
because row A24:I50 are blank.
Is there a way I can modify my code so that I can still look at the total area (A1:I50) and only import the rows that have data?
Specs on the textboxes below:
Path: Path and file name of excel spreadsheet importing
Area: Area on spreadsheet to import
Table: Table importing to
Access Version: 2000/02
Private Sub Command46_Click()
Dim Path As String
Dim Area As String
Dim Table As String
Dim DBSource As String
Me.Path.SetFocus
Path = Me.Path.Text
Me.TableName.SetFocus
Table = Me.TableName.Text
Me.Area.SetFocus
Area = Me.Area.Text
Me.DBSource.SetFocus
DBSource = Me.DBSource.Text
Select Case [ImportType]
Case "MS Excel"
DoCmd.TransferSpreadsheet acImport, 8, Table, Path, True, Area
Case "MS Access"
DoCmd.TransferDatabase acImport, "Microsoft Access", Path, acTable, DBSource, Table, False
End Select
End Sub
Just another note on the code if it's relevant, I'm going to add another case statement so that I can import text files (next project).
Thanks in advance
Tadynn
I'm wondering if anyone can help me.
I've written a database that imports data from various excel spreadsheets over a network daily. While the import process works okay, I'm having problems with blank lines being imported as well.
I have one of my excel files with the following:
Excel File Name: Exceptions Log
Spreadsheet Name: LogData
Total Area: A1:I50
Headers: True
With the code I currently have (see below), I have to open up the spreadsheet, find the last row of data and define that in my "area" text box on my form in access (i.e A1:I23)
because row A24:I50 are blank.
Is there a way I can modify my code so that I can still look at the total area (A1:I50) and only import the rows that have data?
Specs on the textboxes below:
Path: Path and file name of excel spreadsheet importing
Area: Area on spreadsheet to import
Table: Table importing to
Access Version: 2000/02
Private Sub Command46_Click()
Dim Path As String
Dim Area As String
Dim Table As String
Dim DBSource As String
Me.Path.SetFocus
Path = Me.Path.Text
Me.TableName.SetFocus
Table = Me.TableName.Text
Me.Area.SetFocus
Area = Me.Area.Text
Me.DBSource.SetFocus
DBSource = Me.DBSource.Text
Select Case [ImportType]
Case "MS Excel"
DoCmd.TransferSpreadsheet acImport, 8, Table, Path, True, Area
Case "MS Access"
DoCmd.TransferDatabase acImport, "Microsoft Access", Path, acTable, DBSource, Table, False
End Select
End Sub
Just another note on the code if it's relevant, I'm going to add another case statement so that I can import text files (next project).
Thanks in advance
Tadynn