?
Solved

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

Posted on 2011-03-07
5
Medium Priority
?
355 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 2000 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

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.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

765 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