Hi,
i am trying to get Description from linked table:
My whole code is:
I was trying :Code:Option Compare Database Function ConnectToOdbcTables() Dim username, pass As String username = Environ("username") pass = "PasswordAccess" '''You can use a pass-through query to list the table names from your SQL Server database. Open a recordset based on that query. Then loop through the recordset rows and link each table. On Error GoTo ErroHandler strConnect = "ODBC;DRIVER={PostgreSQL Unicode};" & _ "DATABASE=AccessLog;" & _ "SERVER=localhost;" & _ "PORT=5432;" & _ "UID=" & username & ";" & _ "PWD=" & pass & ";" & _ "Trusted_Connection=Yes;" DoCmd.Hourglass True Dim db As DAO.Database Dim tdef As TableDef Dim qdef As QueryDef Dim missingTbl() As String Dim upper As Integer Dim strMsg As String ReDim missingTbl(0 To 0) Set db = CurrentDb For i = 0 To CurrentDb.TableDefs.Count - 1 Set tdef = db.TableDefs(i) Debug.Print tdef.Name '' If Len(tdef.Connect) > 0 And Left(tdef.Name, 1) = "t" Then If Not (tdef.Name Like "MSys*" Or tdef.Name Like "~*") Then tdef.Connect = strConnect tdef.RefreshLink End If Next i For Each qdef In CurrentDb.QueryDefs Debug.Print qdef.Name If qdef.Type = dbQSQLPassThrough Then qdef.Connect = strConnect End If Next qdef DoCmd.Hourglass False Exit Function ErroHandler: MsgBox "Error number is: " & Err.Number & "; " & Err.Description DoCmd.Hourglass False End Function
goal is to get Table name like "public.t_bladeservers".Code:CurrentDb.TableDefs("t_cpuinfo").properties("Description") tdef.Properties("Description")
and method below from immediate also is not working:
but it failed..Code:?CurrentDb.TableDefs("t_cpuinfo").connect ODBC;DRIVER={PostgreSQL Unicode};DATABASE=AccessLog;SERVER=localhost;PORT=5432;Trusted_Connection=Yes;
Please help,
Jacek