Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2006, 07:11 AM
Authorized User
 
Join Date: Apr 2006
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default Data from excel to access

Is it possible to bring data from excel into access only when I want!
I have linked a excel sheet into access but it's getting slowly the base!
I think if I have opened the excel data into access only when I really want it wouldn't be slow!
Maybe with a button I could see the data only when I want!

I would be grateful if you could help me!

 
Old June 14th, 2006, 08:04 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yes.

I would suggest TransferSpreadsheet and put it in a table when needed. That way you only squirt the back end when you want the data, and never create a persistent connection. This means that the functions would be:

DoCmd.OpenQuery (delete query) to remove current data from table.
DoCmd.TransferSpreadsheet (Or database?) to pull data from the spreadsheet.

Did this help?


mmcdonal
 
Old June 14th, 2006, 08:34 AM
Authorized User
 
Join Date: Apr 2006
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks mmcdonal, but the thing it's more complicated!
I've linked the spreddsheet cause I want to be on real time!
I'm taking two fields(with numbers)-(from the linked sheet), continuasly I'm making a query where I sum the two fields.
And in one form xxx, I've brought a subform yyy (the query), to show me the results!
First problem: I can't when I'm opening the real .xls to open the form xxx
Second problem: I can't see the results of the form xxx on the second pc (there two pc connected), when it's already opened in the first pc!

This I'm really trying is in both computer to see the query of the form xxx at the same time, moreover don't getting too late!

I didn't understand where should I type the
DoCmd.OpenQuery
DoCmd.TransferSpreadsheet

and if I won't link the .xls table how could I brought the data of it?

Thank you once again!



 
Old June 14th, 2006, 09:05 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Well you have two contradictory issues here.

IF when you open the form you can't open the spreadsheet, then why have the connection in real time? If the spreadsheet will remain closed when you access the data anyway, why not just import it?

Anyway, on the other questions:

You need to create a table that can accept the data from the spreadsheet.
Then when you pull data from the spreadsheet, you need to have a delete query that runs first to get rid of any old data in the table.
Then transfer in the data from the spreadsheet.

So if you created a delete query called "qryDELETEOldData" your code would look something like:

DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDELETEOldData"
DoCmd.TransferSpreadsheet (look up syntax)
DoCmd.SetWarnings True
DoCmd.OpenForm "frmYourFormXXX", etc



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data transfer from Access to Excel swaroop Access VBA 2 June 1st, 2007 10:30 AM
Access data to Excel Template Hamerw Access VBA 1 November 22nd, 2006 12:38 AM
Converting excel data to Access using excel VBA ShaileshShinde VB Databases Basics 1 April 26th, 2006 07:57 AM
Moving data from Excel to Access ChrisWalsh Excel VBA 1 April 14th, 2005 12:13 PM
retrieving data in excel from access. yesilkalem Access 1 May 25th, 2004 04:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.