473,769 Members | 5,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Path for table linked to spreadsheet

Hi everyone,

I am using Access 2003. I have a database with a table in it which is
linked to an excel spreadsheet. When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.

Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?

I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.

Lots of thanks in advance,

Franc.
Oct 22 '08 #1
7 8428
On Tue, 21 Oct 2008 17:28:58 -0700 (PDT), franc sutherland
<fr************ **@googlemail.c omwrote:

You'd want to read up on RefreshLink a bit more. This function in
combination with the Connect property is how you can change links at
runtime. You can indeed use a constant for the location, or use a
File/Open dialog.

Perhaps this article will help:
http://www.mvps.org/access/tables/tbl0012.htm
And bookmark that site!

-Tom.
Microsoft Access MVP

>Hi everyone,

I am using Access 2003. I have a database with a table in it which is
linked to an excel spreadsheet. When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.

Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?

I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.

Lots of thanks in advance,

Franc.
Oct 22 '08 #2
On Oct 21, 7:28*pm, franc sutherland <franc.sutherl. ..@googlemail.c om>
wrote:
Hi everyone,

I am using Access 2003. *I have a database with a table in it which is
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.

Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?

I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.

Lots of thanks in advance,

Franc.
Franc,

I have an application where I point to multiple spreadsheets based on
standard rules.

In this case, each plant has a folder, and each year of the survey has
its own folder, and each file has the same name. And, I use a generic
table named xlimportsurvey as my link.

So, they choose cmbSurvey and cmbPlantChooser , and I build the file
location as strFileLocation . You, of corse, could just set
strFileLocation as the generic variable.
-----------------------------------------------------------------------------------------------------------
Dim strFileLocation As String

If Not IsNull(Me.cmbSu rvey) And Not IsNull(Me.cmbPl antChooser) Then

strFileLocation = "\\srvr\share\P rojects\Survey\ " & Me.cmbSurvey &
_
"\" & Me.cmbPlantChoo ser & "\sheet_1.x ls"

' This IfThen deletes the old table if it exists because if you don't,
then it just creates a new link with a "1" appended to the end.
If DCount("*", "MsysObject s", "[Name]= 'xlimportsurvey '") Then
DoCmd.DeleteObj ect acTable, "xlimportsurvey "
End If

'This line reestablishes the link to the new location.
DoCmd.TransferS preadsheet acLink, acSpreadsheetTy peExcel8,
"xlimportsurvey ", _
strFileLocation , False, "A3:AG1000"

End If

Me.RecordSource = "qrysurvey" 'This query uses xlimportsurvey as one
of its tables. So, resetting the recordsource is needed, not just a
requery.

'These requeries are for listboxes which need to be repopulated. Not
really relevant to your issue.
Me.Combo46.Requ ery
Me.Combo48.Requ ery
Me.List52.Reque ry

-------------------------------------------------------------------------
Yah, I was lazy and didn't rename Combo46, Combo48, and List52 during
development... :) Crazy the stuff you find when you go back and look
at your old code.

All thanks to whichever Access Gods had the transferspreads heet method
documented on their websites. I found 3 or 4 references to it once I
hit on the right google search.

Jon
Oct 22 '08 #3
On Oct 21, 8:28*pm, franc sutherland <franc.sutherl. ..@googlemail.c om>
wrote:
Hi everyone,

I am using Access 2003. *I have a database with a table in it which is
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.

Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?

I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.

Lots of thanks in advance,

Franc.
Did you use UNC to link your tables/spreadsheets ???
bobh.
Oct 22 '08 #4
On Oct 22, 2:40*pm, Tom van Stiphout <tom7744.no.s.. .@cox.netwrote:
On Tue, 21 Oct 2008 17:28:58 -0700 (PDT), franc sutherland

<franc.sutherl. ..@googlemail.c omwrote:

You'd want to read up on RefreshLink a bit more. This function in
combination with the Connect property is how you can change links at
runtime. You can indeed use a constant for the location, or use a
File/Open dialog.

Perhaps this article will help:http://www.mvps.org/access/tables/tbl0012.htm
And bookmark that site!

-Tom.
Microsoft Access MVP
Hi everyone,
I am using Access 2003. *I have a database with a table in it which is
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.
Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?
I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.
Lots of thanks in advance,
Franc.
Hi Tom,

Thanks for the link. Very useful stuff indeed.

It's bookmarked!

All the best,

Franc.
Oct 23 '08 #5
On Oct 22, 5:56*pm, jonceramic <joncera...@gma il.comwrote:
On Oct 21, 7:28*pm, franc sutherland <franc.sutherl. ..@googlemail.c om>
wrote:
Hi everyone,
I am using Access 2003. *I have a database with a table in it which is
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.
Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?
I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.
Lots of thanks in advance,
Franc.

Franc,

I have an application where I point to multiple spreadsheets based on
standard rules.

In this case, each plant has a folder, and each year of the survey has
its own folder, and each file has the same name. *And, I use a generic
table named xlimportsurvey as my link.

So, they choose cmbSurvey and cmbPlantChooser , and I build the file
location as strFileLocation . *You, of corse, could just set
strFileLocation as the generic variable.
-----------------------------------------------------------------------------------------------------------
Dim strFileLocation As String

If Not IsNull(Me.cmbSu rvey) And Not IsNull(Me.cmbPl antChooser) Then

* * strFileLocation = "\\srvr\share\P rojects\Survey\ " & Me.cmbSurvey &
_
* * * * * * * * * * * * "\" & Me.cmbPlantChoo ser & "\sheet_1.x ls"

' This IfThen deletes the old table if it exists because if you don't,
then it just creates a new link with a "1" appended to the end.
* * If DCount("*", "MsysObject s", "[Name]= 'xlimportsurvey '") Then
* * * * DoCmd.DeleteObj ect acTable, "xlimportsurvey "
* * End If

'This line reestablishes the link to the new location.
* * DoCmd.TransferS preadsheet acLink, acSpreadsheetTy peExcel8,
"xlimportsurvey ", _
* * * * * * * * * * * * * * * * strFileLocation , False, "A3:AG1000"

End If

Me.RecordSource = "qrysurvey" *'This query uses xlimportsurvey as one
of its tables. *So, resetting the recordsource is needed, not just a
requery.

'These requeries are for listboxes which need to be repopulated. *Not
really relevant to your issue.
* * Me.Combo46.Requ ery
* * Me.Combo48.Requ ery
* * Me.List52.Reque ry

-------------------------------------------------------------------------
Yah, I was lazy and didn't rename Combo46, Combo48, and List52 during
development... *:) *Crazy the stuff you find when you go back and look
at your old code.

All thanks to whichever Access Gods had the transferspreads heet method
documented on their websites. *I found 3 or 4 references to it once I
hit on the right google search.

Jon
Hi Jon,

Thanks for that. It is a very different approach and it is always
good to learn about all the different ways that are possible in
Access. I was wondering in your scenario, with the two combo boxes
which build the file pathname string. Does the combo box look up the
file directory and list the options, or do you keep a table with the
names?

All the best,

Franc,
Oct 23 '08 #6
On Oct 22, 5:59*pm, bobh <vulca...@yahoo .comwrote:
On Oct 21, 8:28*pm, franc sutherland <franc.sutherl. ..@googlemail.c om>
wrote:
Hi everyone,
I am using Access 2003. *I have a database with a table in it which is
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.
Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?
I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimed at
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.
Lots of thanks in advance,
Franc.

Did you use *UNC *to link your tables/spreadsheets ???
bobh.
Hi Bob,

Yes, I used \\server\folder \subfolder\ etc....

All the best,

Franc.
Oct 23 '08 #7
On Oct 23, 12:29*pm, franc sutherland
<franc.sutherl. ..@googlemail.c omwrote:
On Oct 22, 5:56*pm, jonceramic <joncera...@gma il.comwrote:


On Oct 21, 7:28*pm, franc sutherland <franc.sutherl. ..@googlemail.c om>
wrote:
Hi everyone,
I am using Access 2003. *I have a database with a table in it whichis
linked to an excel spreadsheet. *When I install the database on
someone else's system, the pathname to the excel file is different.
Howwever, as it is in runtime on their system, I can't update the link
using the Linked Table Manager.
Is there a way of using a public constant to store a path which can be
altered in advance and then combined with a startup module to change
the link path?
I have tried using the rRefreshLink function, but it gives me error
3343, Unrecognised database format. *I think this function is aimedat
re-freshing links to BE mdb files and doesn't work with tables linked
to excel spreadsheets.
Lots of thanks in advance,
Franc.
Franc,
I have an application where I point to multiple spreadsheets based on
standard rules.
In this case, each plant has a folder, and each year of the survey has
its own folder, and each file has the same name. *And, I use a generic
table named xlimportsurvey as my link.
So, they choose cmbSurvey and cmbPlantChooser , and I build the file
location as strFileLocation . *You, of corse, could just set
strFileLocation as the generic variable.
---------------------------------------------------------------------------*--------------------------------
Dim strFileLocation As String
If Not IsNull(Me.cmbSu rvey) And Not IsNull(Me.cmbPl antChooser) Then
* * strFileLocation = "\\srvr\share\P rojects\Survey\ " & Me.cmbSurvey &
_
* * * * * * * * * * * * "\" & Me.cmbPlantChoo ser & "\sheet_1.x ls"
' This IfThen deletes the old table if it exists because if you don't,
then it just creates a new link with a "1" appended to the end.
* * If DCount("*", "MsysObject s", "[Name]= 'xlimportsurvey '") Then
* * * * DoCmd.DeleteObj ect acTable, "xlimportsurvey "
* * End If
'This line reestablishes the link to the new location.
* * DoCmd.TransferS preadsheet acLink, acSpreadsheetTy peExcel8,
"xlimportsurvey ", _
* * * * * * * * * * * * * * * * strFileLocation , False, "A3:AG1000"
End If
Me.RecordSource = "qrysurvey" *'This query uses xlimportsurvey as one
of its tables. *So, resetting the recordsource is needed, not just a
requery.
'These requeries are for listboxes which need to be repopulated. *Not
really relevant to your issue.
* * Me.Combo46.Requ ery
* * Me.Combo48.Requ ery
* * Me.List52.Reque ry
-------------------------------------------------------------------------
Yah, I was lazy and didn't rename Combo46, Combo48, and List52 during
development... *:) *Crazy the stuff you find when you go back and look
at your old code.
All thanks to whichever Access Gods had the transferspreads heet method
documented on their websites. *I found 3 or 4 references to it once I
hit on the right google search.
Jon

Hi Jon,

Thanks for that. *It is a very different approach and it is always
good to learn about all the different ways that are possible in
Access. *I was wondering in your scenario, with the two combo boxes
which build the file pathname string. *Does the combo box look up the
file directory and list the options, or do you keep a table with the
names?

All the best,

Franc,- Hide quoted text -

- Show quoted text -
Well, in my case, I'm downloading a flat excel file from a commerical
survey website. And, I have to do this manually. So, since I have
only 5 folder and I'm the one doing it, I just made it happen manually
by seeding my own lists and using names I create. I never looked into
automating that side of it.

BTW, I realized my raw code is confusing. If I take out the code to
the essence, you're left with this...

strFileLocation = "\\server\folde r\" & strMycustomfold er &
"\subfolder \" & strMycustomfile name
strTableName = "mytablenam e"

If DCount("*", "MsysObject s", "[Name]= '"& strTableName & "'")
Then
DoCmd.DeleteObj ect acTable, strTableName
End If

DoCmd.TransferS preadsheet acLink, acSpreadsheetTy peExcel8,
strTableName _
strFileLocation , False, "A3:AG1000"

Me.RecordSource = strTableName

(NOTE: I use A3:AG1000 as my source because that's where my data
happens to be. You'll obviously pick something different. I think
general Excel conventions work here if you have multiple tabs.)

Jon
Oct 23 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2569
by: James Bird | last post by:
Hello In order to perform a hetrogeneous join (I think that's what they're called) between MySQL and another database, I've created an Access database containing linked tables from each datasource. I create the linked tables without any problems, clicking on "save password" before selecting the desired tables. I can then access both tables fine from within the Access GUI.
3
3474
by: John Lewis | last post by:
I hope someone can help with this. I have a website using Access and ASP developed on my own PC (using PWS) and hosted on a commercial site. I decided that splitting the dbase up would be a good management tactic; it si easy to link from the main database and it works fine - on my own machine. Trouble is when I upload to the commercial host, it takes with it the
3
1438
by: johnsnellx | last post by:
Well, I sure could use some advice (& sympathy). In my Access program I have a small table (200 entries) linked to a main table of over 35,000 entries. While trying to enter a small amount of data into a new table (linked to the main table), I deleted the Zip code column. As you can guess, now the large table doesn't have a zip code column. SO! Can anyone pls tell me if I'm SOL on getting those ZIP Codes back(!), or, at least how can I add...
2
7081
by: m23 | last post by:
Hi, I have an access database unfortunately still running under access 97. This contains a number of linked tables to another access 97 database. I was wandering if there is a way to edit these links as the database the linked tables links to has moved ie c:\directory1\directory2\test.mdb
0
1151
by: reynard.michel | last post by:
Hi, In a sql server database I've a table with a float field. I also have a view on this table. The table and the view are linked in an access database. If I look to theyre properties I get a double type for the table field and a currency for the view. This mean that some data are trucated in the view... How can I correct this? Michel
2
3015
by: jalmar | last post by:
Hello....I'm back again with the same question. I still haven't been able to figure out why my query isn't working. I am linking a table to an Excel spreadsheet, that part is fine, it is even updating correctly (when I update in Excel, the Access table is updated) my problem is when I query out the information that I need from this table-it creates far too many records. I asked this question before and was asked for the SQL but couldn't find...
0
1090
by: ceejee | last post by:
hello there! especially to those experts here in this forum. glad to be here. this is my first post here and sorry if its a problem. later i will try to answer also those questions where i have some nuts of it. well, this is my problem. im trying to copy a certain table in a database(MSACCESS) then save it on the same database by changing its table name but i cant make it happen. i search the web and also here in this forum but i find...
2
7001
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 a different location. A location which I can not access from my own PC when designing the database, so can not use the Linked Table Manager to update the link. I need to find a way of telling the database where the source spreadsheet for the...
10
4558
by: laughlin | last post by:
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...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6668
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.