Solved

automating importing excel data into access database-xtra blank records display

Posted on 2011-03-07
5
352 Views
Last Modified: 2012-05-11
Hello,
i have a excel worksheet on local network- the sheet has a number or fields - but the only field that is filled in when it is imported is the first field 'serial number'- the other fields are blank-
( do not know if this matters).
[procedure]:
User hits button on form in access database- to import data in-
data imports successfully-
When user exits database -they hit button which delete data from table-
User deletes serial numbers on excel sheet and enters new numbers
then procedure happens again:
this time: User hits button on form in access to import data in
and it imports successfully-
ONLY - when they view table to see data imported correctly-
there are extra blank fields
for example if only 4 serial numbers
maybe second time they import- there are 4 extra blank records in table
-do you know what can be causing this?
thank you

Private Sub Command16_Click()
DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "Table2", "\\network1\tw\Excel\Cost1\Table1.xls", True, "Table1!"
DoCmd.OpenForm "frmImport"
Me.Form.Refresh

Exit_CmdImportExcel_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
End Sub



Private Sub Command26_Click()
CurrentDb.Execute "qryDeleteTable2", dbFailOnError

DoCmd.Quit

Open in new window

0
Comment
Question by:davetough
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Expert Comment

by:Richard Daneke
ID: 35057840
The import is importing the area defined in Excel as a Table  (Table2?)

When the delete removes the rows, the table is still defined in Excel
When new data is entered in Excel, your testing is not replacing all of the rows from the earlier table.

0
 
LVL 3

Expert Comment

by:JAMcDo
ID: 35057959
I concur with DoDahD in that the number of rows is set by previous data entry.

See if you can reset the row range before the subsequent import - either manually or with a macro.

J.
0
 

Author Comment

by:davetough
ID: 35058023
only part understand- first how can I manually reset row range?
thank  you
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 35058321
change this

DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "Table2", "\\network1\tw\Excel\Cost1\Table1.xls", True, "Table1!"
DoCmd.OpenForm "frmImport"


with this

DoCmd.TransferSpreadsheet acimport, acSpreadsheetTypeExcel9, "Table2", "\\network1\tw\Excel\Cost1\Table1.xls", True, "Table1!"
DoCmd.OpenForm "frmImport"
0
 

Author Closing Comment

by:davetough
ID: 35058476
thanks
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question