View Single Post
  #1  
Old July 5th, 2009, 10:48 PM posted to microsoft.public.access.formscoding,microsoft.public.access.tablesdbdesign
Paul
external usenet poster
 
Posts: 126
Default replacing a link to a SQL Server table with VBA

I have a link to a SQL Server table that works well when I first create it,
but after a period of an hour or so, it produces a "Connection failed"
message and "Login failed for user" (domain name/login name). So I have to
manually delete and then recreate the link.

I'm going to be talking with our SQL Server administrators to have them fix
the permissions for my account so this hopefully won't keep happening.
However, I've got links to several SQL Server tables from which my queries
update data nightly, and I'd like minimize the risk that there will be an
update failure if and when SQL Server decides to pull this stunt on one of
these tables in the future. So what I would like to do is have VBA delete
all those links to the SQL Server database and then recreate them every
night when I run the update queries.

Here are the ODBC parameters for one of the tables:

ODBC;Description=PSBCC;DRIVER=SQL Server;SERVER=SMF01MSQL005D;APP=Microsoft
Office 2003;WSID=SMF00CTRX037;DATABASE=psbcc;TABLE=dbo.t_ LP_Projects

Is there a way to delete this link in VBA and then replace it with VBA, and
if so, what would the code be to accomplish this?

Thanks in advance,

Paul