Solved

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

Posted on 2011-03-07
5
333 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
5 Comments
 
LVL 18

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 119

Accepted Solution

by:
Rey Obrero 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now