473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dynamic Linked Spreadsheet?

Hello,

I was wondering if it were possible in Access to make a linked spreadsheet's path be based upon the filename of the Access database that it is in.

For instance, if the database is db_2008-01-28, I'd want the linked spreadsheet path to be c:\path\2008-01-28_data.xls. This way, I could create dozens of small (<1MB) databases with different names that would be based on their respectives day's data.

Alternatively, if someone could help me think of a better solution that would be great too. Essentially I have a database that linkes to daily data in the form of excel files. The excel files are too many and too large each to have them all in the database. The database is essentially just a data crucher that takes the daily data that it's linked to, does joins/filters/etc., then spits out one query that a pivot table in an excel application I've developed makes use of.

Further complicating things is that no one has write access to the directory that the database is in. That's why I need the database to update its linked table paths by itself whenever the main query is called from the excel application.

Thank you for any help!
Jan 28 '10 #1

✓ answered by nico5038

See my "Function fncRelink()" code in my last post in http://bytes.com/topic/access/answer...r-password-vba

Using the replace() will enable you to relink your excel tables.

Nic;o)

10 4517
Whoops, forgot to mention this is Access 2007 on Windows XP.
Jan 28 '10 #2
nico5038
3,080 Expert 2GB
The variable currentdb.Name will return the database name and the full path.
So using:
Expand|Select|Wrap|Line Numbers
  1. Replace(currentdb.name,"<name of your accdb or mdb>","2008-01-28_data.xls")
  2.  
will give what you want.

Nic;o)
Jan 28 '10 #3
ADezii
8,834 Expert 8TB
If you wish to dynamically translate
Expand|Select|Wrap|Line Numbers
  1. C:\YaDa\YaDa\YaDa\db_yyyy-mm-dd.accdb
TO
Expand|Select|Wrap|Line Numbers
  1. C:\Path\yyyy-mm-dd_data.xls
for each day, then
Expand|Select|Wrap|Line Numbers
  1. "C:\Path\" & Replace(Mid$(CurrentDB.Name, Instr(CurrentDb.Name, "db_")+3),".accdb","") & "_data.xls"
will do the trick.
Jan 29 '10 #4
Hey guys,

Thank you for the replies. However, I realize my original question was worded confusingly.

When I say that I want to make a linked spreadsheet's path be based upon the filename of the Access database that it is in, I'm talking about the path to the spreadsheet in Access. So in this database: db_2008-01-28, I want the actual link to a spreadsheet (c:\path\YYYY-MM-DD_data.xls) to dynamically update based on what the database is named. So if I were to close the database, rename it to db_2009-04-15, then I when I open it again I want the linked spreadsheet to be c:\path\2009-04-15_data.xls. I don't think I can use a macro for this because I need this solution to work in a directory where the user (everyone but me) does not have write access.

So I'm not trying to do any spreadsheet renaming. I'm trying to make the link in the database be variable- i.e. based upon the filename of the database it's in.

Thanks!
Jan 29 '10 #5
ADezii
8,834 Expert 8TB
Isn't that what post #4 does?
Jan 29 '10 #6
That will certainly help me to create the proper string, but when I go in to the linked table manager I don't see a place where I could use such code. As far as I can tell I can only manually update the link to the spreadsheet. Instead, I want it to self-update based on the filename (using the code you gave).

Does that make sense?

Thank you.
Jan 29 '10 #7
ADezii
8,834 Expert 8TB
You can programmatically create the Link with VBA code.
Jan 29 '10 #8
nico5038
3,080 Expert 2GB
See my "Function fncRelink()" code in my last post in http://bytes.com/topic/access/answer...r-password-vba

Using the replace() will enable you to relink your excel tables.

Nic;o)
Jan 29 '10 #9
NeoPa
32,556 Expert Mod 16PB
That code should indeed give you what you're looking for. Let us know if you manage to get that to work. I'm not sure if the fact that the database is read-only may interfere with that working.
Jan 30 '10 #10
Thank you everyone. Given my exact situation these solutions won't work (since the database is read only), but I certainly have ideas now!
Feb 2 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: me here | last post by:
I have a VBA subroutine that links an MS Excel spreadsheet and copies the data into a local table. This process is controlled by a form that allows users to select the spreadsheet from the file...
8
by: Janelle.Dunlap | last post by:
My database is linked to external data from a single Excel spreadsheet. I currently have it so that the entire spreadsheet exports into one table, but really for the purpose of my database it will...
3
by: Janelle.Dunlap | last post by:
I have a table in my database that is linked to an excel spreadsheet. I need to be able to manipulate the data in this linked table so that I can create smaller normalized tables that work with...
2
by: eakkas | last post by:
All I need to do is; on the click of a button, import the numerical data in an html form (only one field) to a cell in a spreadsheet. Both spreadsheet and the html file reside on the same server...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
2
by: crimestarter.jim | last post by:
Good afternoon, I am not the most informative when it comes to Microsoft Access. I have a user that is using Access 2003 and has 1 excel spreadsheet linked to 3 different databases. They are...
6
by: kumana1 | last post by:
I have an Excel spreadsheet that is linked as a table in my database. I can make objects in my db based off of the linked spreadsheet, but I cannot make changes to any of the data. The only way I...
0
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
4
by: Bongard | last post by:
I have a dynamic range that I would like to use as a linked table into Access. The problem is that Access doesn't seem to want to to recognize the dynamic range when you click on "show named...
2
by: franc sutherland | last post by:
Hello everyone, I am using Access 2003. In my database there is a table which is linked to an excel spreadsheet. When I move the mdb file to someone else's computer the spreadsheet will be in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.