auto refresh of linked odbc table

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?
 
P

Pieter Wijnen

yes

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

HTH

Pieter
 
P

Pieter Wijnen

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
 
S

seth

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"
 
P

Pieter Wijnen

Macros doesn't understand subs - you have to change it to a function...

HTH

Pieter
 
S

seth

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."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top