[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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