Thank you John...it works!,,,but why do my code doesn't work?, it seem it almost similiar to your code,,,i know i didn't declare "tdf As DAO.TableDef",,,
but what is the diffrence to :
Db.TableDefs("T_1_PEG").Connect = ";Database=" & sLinkAddress
Db.TableDefs("T_1_PEG").RefreshLink
Is it just because i have to declare a TableDefs first?...
Regards
Hendra Agestha
--------------------------------------------
Pada Sab, 8/3/14, John Viescas <JohnV@msn.com> menulis:
Judul: Re: [MS_AccessPros] Refresh a Linked table
Kepada: MS_Access_Professionals@yahoogroups.com
Tanggal: Sabtu, 8 Maret, 2014, 12:30 AM
Hendra-
Try this:
Dim Db As DAO.Database, tdf As DAO.TableDef
Dim sLinkAddress As String
sLinkAddress = "D:\HDK_DB\AG_BE.mdb"
Set Db = CurrentDb
Set tdf = db.Tabledefs("T_1_PEG")
tdf.Connect = ";Database=" & sLinkAddress
tdf.RefreshLink
MsgBox "Refreshed"
Of course, that won't work either if your table
isn't actually a linked table.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
On Mar 7, 2014, at 6:21 PM, Agestha Hendra
<agesthahendra@ymail.com> wrote:
> Hi All... :)
>
> I want to refresh a linked table, i tried this code :
>
>
'----------------------------------------------------------
> Dim Db As Database
> Dim sLinkAddress As String
>
> sLinkAddress = "D:\HDK_DB\AG_BE.mdb"
> Set Db = CurrentDb
>
> Db.TableDefs("T_1_PEG").Connect =
";Database=" & sLinkAddress
> Db.TableDefs("T_1_PEG").RefreshLink
>
> MsgBox "Refreshed"
>
'----------------------------------------------------------
>
> but got an erorr :
>
> Invalid Operation, and
"Db.TableDefs("T_1_PEG").Connect =
";Database=" & sLinkAddress" was highlited
>
> Please give me directions to solve this,,,it would be
appreciated,, thank you.
>
> Regards
> Hendra Agestha
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
>
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar