473,513 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing mdb filename from linked table connect property

From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween
Nov 12 '05 #1
2 3640
InstrRev() is useful from A2000 onwards.

Alternatively, you can use the fact that Dir() loses the path:
Dir(Mid(dbEngine(0)(0).TableDefs("MyTable).Connect , 11))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween

Nov 12 '05 #2
Thanks Allen

"Allen Browne" <al*********@SeeSig.invalid> wrote in message
news:jx********************@news-server.bigpond.net.au...
InstrRev() is useful from A2000 onwards.

Alternatively, you can use the fact that Dir() loses the path:
Dir(Mid(dbEngine(0)(0).TableDefs("MyTable).Connect , 11))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween


Nov 12 '05 #3

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

Similar topics

3
1755
by: Gerry Abbott | last post by:
Hi all, Could someone tell me how I can tell (in code) if a table in the current db is a linked one or not? Thanks, Gerry
2
2105
by: aleatory | last post by:
Hi Access masters, Sorry for asking a very simple question, but how could I locate source tables which have been linked into the Access database? The following is an ASCII- based screen shot: | +=============================================== | | db1: Database | +-----------------------------------------------
4
18933
by: Neil Ginsberg | last post by:
I have ODBC linked tables to a SQL 7 database in an A2K database. The linked tables do not have the password stored in them, so the first time the user accesses them, they need to enter the SQL password. I am developing a process that will automatically run at night which will access those tables. I need to be able to give Access the...
3
11755
by: colin.anderson | last post by:
Hi I am trying to refresh table links at startup in an Access 2002 application. The following code is based on a number of articles posted in this group but this does not seem to work: ===CODE SNIPPET START=== For i = 0 To CurrentDb.TableDefs.Count - 1 If Left(CurrentDb.TableDefs(i).NAME, 3) = "tbl" Then
7
2452
by: bill.brennum | last post by:
Hi, Have a number of Access Databases that I inherited and want to zip a few of them. My concern is that other active Microsoft Applications may be linking to the database or its tables. Is there a method of searching that will allow me to identify those MS Access files that are linked to. I am not really concerned with itemizing the...
23
1745
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about 25-50). This allows each user to have their own set of selections. The selections table has three fields: ID (int), Sel (bit), MachName (varchar). ID...
25
45695
by: bubbles | last post by:
Using Access 2003 front-end, with SQL Server 2005 backend. I need to make the front-end application automatically refresh the linked SQL Server tables. New tables will be added dynamically in the future, so the front-end application must have a way to keep up with this (instead of manually linking them).
5
1424
by: susan | last post by:
Hi, In my application I want the location of my application-database as well as the location of my data-database to be displayed. I retrieve the name of the application by: ApplName = DBEngine(0)(0).Name In the application I use links to the tables of my data-database. How can I retrieve the location / name of the data-database?
18
4449
by: afromanam | last post by:
Whew.. OK, running access 2003 in win xpsp2 and access 2007 in win vista. This is the question... We have a db, split in front end (FE.mdb) and backend (BE.mdb) FE has tons of linked tables from BE.
0
7177
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...
0
7394
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
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...
0
3248
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...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
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...

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.