Excel to Access Dynamic Linking

Rahul Sehrawat
Rahul Sehrawat used Ask the Experts™
on
Hello,

I want to dynamically link an excel file with access. There are many calculations like age and all where the data is calculated against the current date.

What I understand is, it is impossible to link an excel file with calculations. Now what I want is, that the user will be choose an excel file (can be 2003, 2007 or 2010 format). It will open the excel file (which will calculate the fields with calculations), save it and close the file. and will dynamically link/import the data.

Regards,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
You can't directly write to a linked Excel file from Access.  Linked Excel files are read-only. See the following:
http://www.theregister.co.uk/2006/02/07/microsoft_office_access_infringement/

A workaround would be to either link to an Excel File (read only) or import it using Docmd.TransferSpreadsheet.

Query/modify data as needed in local access tables and queries, and then export the modified/calculated data as needed.

Author

Commented:
But is it not possible, to open and then save the file and then close it. because upon opening the excel file, it will update all the calculated fields.
armchair_scouseDeveloper

Commented:
If you turn off Automatic Calculation in Excel when the file is open, and then save the file, that will stop the file from updating the fields automatically when you open the file in the future, until you press F9 or select Calculate Now from the Formulas tab in Excel (presuming you are using Excel 2007/2010, that is).
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
Hi,

I actually want it to do automatic calculation. So even when I open the excel file, it actually calculates the fields. So I dont want to turn off automatic calculations.
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
anshuverma1989,

...Then perhaps you are not making the parameters of your process clear:...?

<I want to dynamically link an excel file with access.>
Not possible in the way you are requesting (keeping dynamic calculations)...

<that the user will be choose an excel file (can be 2003, 2007 or 2010 format). >
I assume you have a utility in Access to select the file in place already?

<It will open the excel file (which will calculate the fields with calculations), save it and close the file. and will dynamically link/import the data.>
Clearly define "dynamically link/import the data."?
Linking and Importing are two different things.


Whats the need for Access anyway? Why not keep this all in Excel?
Alternatively, ...why not move all of this to Access?

JeffCoachman
Hi,

I have attached a demo access and excel data file. I somehow managed to make the basic package on my own.

The package will will open, make calculations and save the excel file specified by the user. Then it will link the same excel file.

Regards
Access.accdb
Excel.xlsx
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Still not sure why Excel is needed, but if you have something that works, then roll with it...

Author

Commented:
Hi,

Then how will the user add his/her own fields. Also, how will be software calculate the fields with calculations.

If you see my access file, the reports which will be exported will also be dynamic. It will depend on the fields selected by the user.

I see this as the best thing I could do. :)
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
I see no reason why this all can't all be done in Access, ...

But again, if your solution works, the go with it.

Author

Commented:
I managed to solve the problem on my own.
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial