relink tables on open (1 Viewer)

Tomm

New member
Local time
Today, 10:33
Joined
Nov 6, 2008
Messages
7
Hi all.

in Access 2003 I have a linked View from a sql database, which I then use on a form. I have made changes to the View but these are not replicated on the Access view.

Is there a way of automatically relinking the View on Form Load/Open? VBA code would be best but suppose I could use a Macro?

Thanks!
 

WayPay

Registered User.
Local time
Today, 11:33
Joined
Nov 3, 2008
Messages
118
In Access 2003, AFAIK, there is no such thing as a "linked view". If there is, I'd love to know how :D. If you want the same view in different databases, you'll have to copy it.

Not sure if this holds true for SQL server, but if it does, you would have to copy the view SQL to your mdb's query definition.
 

Kiwiman

Registered User
Local time
Today, 10:33
Joined
Apr 27, 2008
Messages
799
Howzit

Linking to a SQL view is no different to linking to a SQL table, as they are included in the list tables that you can select from - not a separate tab. It does not specifically say View, unless you have View in the View name. We do it all the time for data analysis.

Sorry - I don't have enough knowledge on relinking the views on open, as our views haven't changed for years.
 

Rabbie

Super Moderator
Local time
Today, 10:33
Joined
Jul 10, 2007
Messages
5,906
I have seen and used code which relinks on Load. I downloaded it from the net from this link
 

JuriSim

Registered User.
Local time
Today, 11:33
Joined
Jun 10, 2008
Messages
13
Linking a sql-table or view is just the same.
You can refresh the link in the load of your application with "refreshlink" (see post of Rabbie)

One remark: when you link a view; Access will ask what the primary key is. After a while this primary key will be lost.
you can re-add the primary key making use of:
DoCmd.RunSQL "create unique index xxxUniqueIndexname_ForView on xxViewname_VW([xxKey])"

xxxUniqueIndexname_ForView -> is a unique string
xxViewname_VW -> is your view-name
xxkey -> is primary key field in your view.
 

jeddell

New member
Local time
Today, 19:33
Joined
Mar 18, 2010
Messages
1
Can anybody show how to call this function? have the code installed into a module, but When I call it from a form, I get an Ambiguous name error.
 

boblarson

Smeghead
Local time
Today, 02:33
Joined
Jan 12, 2001
Messages
32,059
Can anybody show how to call this function? have the code installed into a module, but When I call it from a form, I get an Ambiguous name error.

Sounds like you named the module the same as the function. Make sure the module name is DIFFERENT from the function name.
 

Users who are viewing this thread

Top Bottom