Solved Retrieve the linked file path to a text box (1 Viewer)

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
Hi,

I'm trying to run a relink routine depending on what the current link path is for a table called 'tblBookings_ALL', so basically it would be along the lines of:

"If link path for tblBookings_ALL = txtLinkedFilePath (which would be "S:\TutorialBookings\Tables_BackEnd\TutorialBookings_BE.accdb" then....
...run code to relink to a different path.

I have the relink code running OK, all I need is to pull the current link path into a text box.

There is some pretty useful code attached which I'm sure works, but I can't get the path into the text box 'txtLinkedFilePath' so I must be doing something dumb. I just put the default value for the text box as the function name (GetLinkedTablePath) but it's returning #error. I've tried a few combinations of putting the actual table name into the code but I can't get it to do anything but show #Error. The code I'm using is attached. I've included the comments to be fair to the coder as i've just been trying to use wholesale his code. Is their a simpler way of what I want to do, or should this work fine?
 

Attachments

  • GetLinkedTablePath.txt
    2.3 KB · Views: 75

theDBguy

I’m here to help
Staff member
Local time
Today, 01:10
Joined
Oct 29, 2018
Messages
21,473
Did you try something like?
Code:
=GetLinkedTablePath("tblBookings_ALL")
 

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
Thanks DBGuy - I'm pretty sure I did, but as you've ID'd that i'll have a go again restarting the db first. There's no need to put tblBookings_ALL in the module code is there?...just trying again....
 

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
No it gave same error - sorry the error is #Name? (not #error)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:10
Joined
Oct 29, 2018
Messages
21,473
Thanks DBGuy - I'm pretty sure I did, but as you've ID'd that i'll have a go again restarting the db first. There's no need to put tblBookings_ALL in the module code is there?...just trying again....
No, you're not supposed to modify the module at all - just use it. What I showed you would be an example of how you could use it.
 

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
Thanks - thought so - well it appears that the code seems right, and the way to call it too, so i'll have to try and figure out what is stopping it from running. Cheers again.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:10
Joined
Oct 29, 2018
Messages
21,473
Thanks - thought so - well it appears that the code seems right, and the way to call it too, so i'll have to try and figure out what is stopping it from running. Cheers again.
Perhaps you could consider posting a sample/demo db?
 

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
Thanks -I will, i'll just do a spot of tidying up lol....
 

nortonm

Registered User.
Local time
Today, 09:10
Joined
Feb 11, 2016
Messages
49
Ah, it must have been a dodgy text box, I deleted it, added a new one, and it worked this time, I must have done something to it when changing the values. Many thanks for confirming the code for me, i'd have been messing about all day checking it!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:10
Joined
Oct 29, 2018
Messages
21,473
Ah, it must have been a dodgy text box, I deleted it, added a new one, and it worked this time, I must have done something to it when changing the values. Many thanks for confirming the code for me, i'd have been messing about all day checking it!
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom