auto refresh of linked odbc table

  • Thread starter Thread starter seth
  • Start date Start date
S

seth

i have a linked odbc table; i can manually refresh through linked table
manager, but is there any way to somehow automatically refresh?
 
yes

Sub relinktable(ByVal tname As String)
Dim tdef As DAO.TableDef
Set tdef = Access.CurrentDb.TableDefs(tname)
tdef.RefreshLink
End Sub

HTH

Pieter
 
Rewrite it to a function (module - new - paste code save as basLink)

Function RelinkTable(ByVal tname As String)
Dim tdef As DAO.TableDef
Set tdef = Access.CurrentDb.TableDefs(tname)
tdef.RefreshLink
End Function

Modify your AutoExec Macro:
Add line as follows
Action: RunCode
Function Name: RelinkTable("NameOfLinkedTable")

HTH

Pieter
 
hmmm....
this is my code

Sub RelinkTable(ByVal tname As String)
Dim tdef As DAO.TableDef
Set tdef = Access.CurrentDb.TableDefs(dbo_tb_url_usage)
tdef.RefreshLink
End Sub


the macro has the run code action with this for function name (with or
without quotes doesn't change outcome)

RelinkTable(dbo_tb_url_usage)

running the macro generates "The expression you entered has a function name
that Microsoft Office Access can't find"
 
Macros doesn't understand subs - you have to change it to a function...

HTH

Pieter
 
that's what i was thinking, but didn't know it was that simple
ok...so made that change, and now access says...

"Microsoft Office Access can't find the name 'dbo_tb_url_usage' you entered
in the expression.
You may have specified a control that wasn't on the current object without
specifying the correct form or report context."
 
Back
Top