ODBC connected attribute ???

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hello to everybody,
I have an Access97 Database with
ODBC-connected tables to a SQL Server (7.0)
I created a form wich links automatically
the SQL Server tables to my mdb file.
That's ok.So far so good.
But when i try to delete the links,checking
the Tabledefs Attribute if it is equal to
dbAttachedODBC,I notice that no table has
this specific attribute.
Why? They are linked via ODBC.....
The long value of dbAttachedODBC is 536870912
My tables attribute is 537001984....and there is
no attribute with this number associated.

I apreciate any help/suggestion

Thanks in advance!
George
 
'This procedure deletes all linked ODBC table names in an mdb.
Public Sub DeleteODBCTableNames()
On Error GoTo Err_DeleteODBCTableNames

Dim dbs As Database, tdf As TableDef, I As Integer
Set dbs = CurrentDb
For I = dbs.TableDefs.Count - 1 To 0 Step -1
Set tdf = dbs.TableDefs(I)
If (tdf.Attributes And dbAttachedODBC) Then
dbs.TableDefs.Delete (tdf.Name)
End If
Next I

dbs.Close
Set dbs = Nothing

Exit_DeleteODBCTableNames:
Exit Sub

Err_DeleteODBCTableNames:
MsgBox ("Error # " & Str(Err.Number) & " was generated by " & Err.Source
& Chr(13) & Err.Description)
Resume Exit_DeleteODBCTableNames

End Sub
 
537001984 = 536870912 + 131072
= dbAttachedODBC + dbAttachSavePWD
= &H20000000 + &H20000

(david)
 
Hello to everybody,
I have an Access97 Database with
ODBC-connected tables to a SQL Server (7.0)
I created a form wich links automatically
the SQL Server tables to my mdb file.
That's ok.So far so good.
But when i try to delete the links,checking
the Tabledefs Attribute if it is equal to
dbAttachedODBC,I notice that no table has
this specific attribute.
Why? They are linked via ODBC.....
The long value of dbAttachedODBC is 536870912
My tables attribute is 537001984....and there is
no attribute with this number associated.

I apreciate any help/suggestion

Thanks in advance!
George

Attributes generally may be combined.
That is we may be both sexy and intelligent.
If Sexy is 1 and Intelligent is 2 then our attributes will be (at least)
1 Or 2
=
3
(Note
2 Or 6
<>
8)

To check for a specific attribute we often use
Attributes And SpecificAttribute = SpecificAttribute
(we should be able to use just Attributes And SpecificAttribute but why take
chances with a company famous for being perverse?)

Note that
537001984 And 536870912
=
536870912

The base 16 (hex) manisfestation of these numbers allows us to grasp
their relationship a bit more intuitively:
20020000 20000000

And, of course the base 2 (bin) notation is clearest of all:
100000000000100000000000000000
100000000000000000000000000000

You can see that we are actually just checking to see which switches are
turned on, or which flags are up, or which voltages are great enough to
register.
 
Back
Top