Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linked Table check

Status
Not open for further replies.

darkhat01

IS-IT--Management
Apr 13, 2006
144
US
I would like to check if there is a linked table with an If Statement, I am not sure how to check if a table exists, here is what I have so far. The linking of the database does currently work; I just need to do a table check.

Any ideas????

Thanks,

Darkhat01


If "there is not a table called "GlueErrorlog"" Then

DoCmd.TransferDatabase _
acKink, _
"Microsoft Aaccess", _
"\\C:\CoreDatabase\GlueLog.mdb", _
acTable, _
"GlueErrorLog", _
"GlueErrorLog"

End IF
 
Many SQL databases support INFORMATION_SCHEMA 'tables'. These are psuedotables that allow you to query database metadata (tables, views, column names, data types etc).

I don't know if Access is one of them. Don't have a copy on this PC, maybe you can check your help file? If it does, you could run a query to find out if the table exists.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Do you know how to unlink a linked table?
 
One way:
On Error Resume Next
Dim strName As String
strName = CurrentDb.TableDefs("GlueErrorLog").Name
On Error GoTo 0
If strName <> "GlueErrorLog" Then
DoCmd.TransferDatabase _
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV thanks for the help.

So this kind of works, What happens is if the GlueErrorLog exist then it creates a new one called GlueErrorLog1, then GlueErrorLog2... Also what do the two error chatcher do? What is goto 0, where is 0???

Thank you,

Darkhat01

On Error Resume Next 'What does this do????
Dim strName As String
strName = CurrentDb.TableDefs("GlueErrorLog").Name
On Error GoTo 0 'What does this do????
If strName <> "GlueErrorLog" Then

DoCmd.TransferDatabase _
acKink, _
"Microsoft Aaccess", _
"C:\CoreDatabase\GlueLog.mdb", _
acTable, _
"GlueErrorLog", _
"GlueErrorLog"

End If
 
Thanks PHV,
I got it to work with your help.

You have helped me in the past and now you have helped me again, thanks for everything you have done. Sometimtes it helps to have someone look at it.


Thanks you,

Darkhat01
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top