title image


Smiley TIPP: Tabellenverknüpfungen ausgeben (VBA)
Z.B. so:



Public Function ListMyDSNs()

Dim Tbl As DAO.TableDef, DB As DAO.Database, RS As DAO.Recordset, I As Long, Tmp As String, S As Variant, T As Variant, WriteIt As Boolean

Set DB = CurrentDb

On Error Resume Next

DB.Execute "DROP TABLE tblMyDSNs"

On Error GoTo 0

DB.Execute "CREATE TABLE [tblMyDSNs] ([TblName] Text(255), [DSN] Text(255), [Server] Text(255), [User] Text(255), " & _

"[PWD] Text(255), [Port] Text(255), [Desc] Text(255), [Database] Text (255))"

Set RS = DB.OpenRecordset("tblMyDSNs", dbOpenDynaset)

For Each Tbl In DB.TableDefs

If Tbl.Connect "" Then

WriteIt = False

S = Split(Tbl.Connect, ";")

RS.AddNew

RS!TblName = Tbl.Name

For I = LBound(S) To UBound(S) ' Durch alle ;-getrennten Parameter gehen

T = Split(S(I), "=")

If UBound(T) > 0 Then

Debug.Print Tbl.Name, T(0), T(1)

Err.Clear

On Error Resume Next ' Fehler verhindern, wenn Feld nicht existiert

RS(T(0)) = T(1)

If Err.Number = 0 Then WriteIt = True ' Mindestens ein Feld vorhanden

On Error GoTo 0 ' Fehlerbehandlung wieder einschalten

End If

Next I

If WriteIt Then RS.UpDate

End If

Next Tbl

RS.Close

Set RS = Nothing

Set DB = Nothing

End Function





Gruß aus dem Norden
Reinhard


Bitte immer die Access-Version angeben!
DB-Wiki


Wie man Fragen richtig stellt

YaccessAccess-FAQUnd ansonsten: Wikipedia




geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: