473,322 Members | 1,425 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,322 software developers and data experts.

How do I test for an existing link before linking to a BE file?

Ron
Hi,

Having trouble with tblCustomer, tblCustomer1, tblCustomer2, etc appearing
if I've already got a link between the front end and back end and I try to
link to tblCustomer. So, how do I code a test to make sure the table isn't
*already* linked before linking it?

Using Access2000 if it matters.

TIA,
ron
Apr 25 '06 #1
1 2126
here is some code you can experiment with. This codes tests if a table
in the TableDefs collections is linked by testing the connect string.
If the connectstring is not "" then it is a linked table.

Sub tblLinks()
Dim DB As DAO.Database, tdf As DAO.TableDef
Set DB = CurrentDb
For Each tdf In DB.TableDefs
If tdf.Connect <> "" Then Debug.Print tdf.Name & " is a linked
table"
'--or
'If (tdf.Attributes And dbAttachedTable) = dbAttachedTable Then
Debug.Print tdf.Name; " is a linked table"
Next
End Sub

And to re-link a table you can do this :

Sub ReLink()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strPath As String
strPath = "<SomePathToBackEndDatabase>"
Set db = CurrentDb()
For Each tdf In db.TableDefs
If (tdf.Attributes AND dbAttachedTable) = _
dbAttachedTable Then
tdf.Connect = ";DATABASE=" & strPath
tdf.RefreshLink
End If
Next
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 25 '06 #2

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

Similar topics

2
by: faktujaa | last post by:
Hi All, I have to avoid cyclic reference in my DLLS. One way is to move the code to the common DLL. But now since i have written a lot of code, it would take a whole lot of time to do this. The...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
22
by: Rudy Ray Moore | last post by:
Why is "Visual Studio .net 2003 7.1 c++" so much slower than VS6 at linking? It looks like "Visual Studio .net 2003 7.1 c++" doesn't even do incremental linking! I make one very minor change in...
3
by: Alex Shturm | last post by:
Hi, I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big project (executable size is more than 100Mb, and it gets linked from several dozen of libraries and object...
27
by: Josh | last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been...
3
by: rdemyan via AccessMonster.com | last post by:
I just got Access 2003 and have been playing around with it. This whole macro security thing can be a bit annoying. Initially, I was able to link to my backends located on a second computer....
13
by: rdemyan via AccessMonster.com | last post by:
My front-end code manually links to the backend file. I was wondering what stops Access from linking to the system tables in the backend file. Is it just by virtue that they are hidden? This...
8
by: Bern McCarty | last post by:
We have a large mixed dll that I can never seem to get to link incrementally. Below is the console output. For simplicity I've eliminated some stuff that we normally do when we really link this...
3
by: geoplab | last post by:
I have this error message when compiling mx_init.c by linking libxml library as follow: gcc `xml2-config --cflags` -c mx_init.c `xml2-config --libs` -g -Wall gcc: -lxml2: linker input file...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.