Hendra-
I suspect it's because you have to "open" the TableDef (set to an object) before you can change its properties. That is probably certainly true if you need to set a property AND execute a method depending on that changed property.
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 8, 2014, at 1:40 PM, Agestha Hendra <agesthahendra@ymail.com> wrote:
> 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
>
>>
>
>>
>
>>
>
>>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
>
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)
<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
Tidak ada komentar:
Posting Komentar