dbTalk Databases Forums  

How to use .connect on a specific linked table?

comp.databases.ms-access comp.databases.ms-access


Discuss How to use .connect on a specific linked table? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jonceramic
 
Posts: n/a

Default How to use .connect on a specific linked table? - 05-19-2011 , 02:26 PM






Hi Everyone,

I'm trying to look and see what the .connect string is to a linked
table. I want to make sure the user has security to it, and warn them
if they don't.

I want to do this without resorting to error trapping a dlookup().

There's lots of code on using .connect in a "foreach" loop on a
collection of objects to reset connections. But, I'm completely
confused on how to use it when I just want to see the Connect string
on a single known, named table.

I've tried just simply saying:
CurrentDb.tabledefs("linkedtablename").Connect

But that doesn't work.

I'm not opposed to using an object, but I'm a complete dummy with
them. And, I don't know how to put in "tablename" in the example code
I've read.

Please help!

Thanks,

Jon
p.s. What happened to http://www.mvps.org/access? I'm getting a 503
error.

Reply With Quote
  #2  
Old   
jonceramic
 
Posts: n/a

Default Re: How to use .connect on a specific linked table? - 05-19-2011 , 02:32 PM






On May 19, 2:26*pm, jonceramic <joncera... (AT) gmail (DOT) com> wrote:
Quote:
Hi Everyone,

I'm trying to look and see what the .connect string is to a linked
table. *I want to make sure the user has security to it, and warn them
if they don't.

I want to do this without resorting to error trapping a dlookup().

There's lots of code on using .connect in a "foreach" loop on a
collection of objects to reset connections. *But, I'm completely
confused on how to use it when I just want to see the Connect string
on a single known, named table.

I've tried just simply saying:
CurrentDb.tabledefs("linkedtablename").Connect

But that doesn't work.

I'm not opposed to using an object, but I'm a complete dummy with
them. *And, I don't know how to put in "tablename" in the example code
I've read.

Please help!

Thanks,

Jon
p.s. What happened tohttp://www.mvps.org/access?*I'm getting a 503
error.
I take it back. This does work...
CurrentDb.tabledefs("linkedtablename").Connect

And then you can use
len(CurrentDb.tabledefs("linkedtablename").Connect ) < 0 to see if it's
a linked table.

I was just screwing up in my immediates window, and not typing "print"
beforehand.

Jon

Reply With Quote
  #3  
Old   
jonceramic
 
Posts: n/a

Default Re: How to use .connect on a specific linked table? - 05-19-2011 , 02:54 PM



On May 19, 2:32*pm, jonceramic <joncera... (AT) gmail (DOT) com> wrote:
Quote:
On May 19, 2:26*pm, jonceramic <joncera... (AT) gmail (DOT) com> wrote:





Hi Everyone,

I'm trying to look and see what the .connect string is to a linked
table. *I want to make sure the user has security to it, and warn them
if they don't.

I want to do this without resorting to error trapping a dlookup().

There's lots of code on using .connect in a "foreach" loop on a
collection of objects to reset connections. *But, I'm completely
confused on how to use it when I just want to see the Connect string
on a single known, named table.

I've tried just simply saying:
CurrentDb.tabledefs("linkedtablename").Connect

But that doesn't work.

I'm not opposed to using an object, but I'm a complete dummy with
them. *And, I don't know how to put in "tablename" in the example code
I've read.

Please help!

Thanks,

Jon
p.s. What happened tohttp://www.mvps.org/access?*I'm getting a 503
error.

I take it back. *This does work...
CurrentDb.tabledefs("linkedtablename").Connect

And then you can use
len(CurrentDb.tabledefs("linkedtablename").Connect ) < 0 to see if it's
a linked table.

I was just screwing up in my immediates window, and not typing "print"
beforehand.

Jon- Hide quoted text -

- Show quoted text -
BTW, this shows the string whether the user has access or not.
Grrrrr...

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: How to use .connect on a specific linked table? - 05-19-2011 , 03:16 PM



jonceramic wrote:
Quote:
On May 19, 2:32 pm, jonceramic <joncera... (AT) gmail (DOT) com> wrote:
On May 19, 2:26 pm, jonceramic <joncera... (AT) gmail (DOT) com> wrote:

And then you can use
len(CurrentDb.tabledefs("linkedtablename").Connect ) < 0 to see if
it's a linked table.

I was just screwing up in my immediates window, and not typing
"print" beforehand.


BTW, this shows the string whether the user has access or not.
Grrrrr...
Nobody ever said Access was designed for enterprise-level security ...

Reply With Quote
  #5  
Old   
John Spencer
 
Posts: n/a

Default Re: How to use .connect on a specific linked table? - 05-20-2011 , 08:20 AM



The only way I know to discover if the user has permissions to the linked
table is to attempt to do a read of the table.

What is the database engine involved? If it is MS SQL Server 2005 (and
probably later) you can use a pass through query to get permissions on
specific tables, but if the user has no permission to the database server or
the specific database on the server, it still errors.

SELECT * FROM fn_my_permissions('TheTableName', 'OBJECT')
WHERE Permission_Name = 'Insert'

If you leave off the WHERE clause, you can get multiple records returned for
different permissions - Insert, Update, Read, Delete, etc.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 5/19/2011 4:16 PM, Bob Barrows wrote:
Quote:
jonceramic wrote:
On May 19, 2:32 pm, jonceramic<joncera... (AT) gmail (DOT) com> wrote:
On May 19, 2:26 pm, jonceramic<joncera... (AT) gmail (DOT) com> wrote:

And then you can use
len(CurrentDb.tabledefs("linkedtablename").Connect )< 0 to see if
it's a linked table.

I was just screwing up in my immediates window, and not typing
"print" beforehand.


BTW, this shows the string whether the user has access or not.
Grrrrr...

Nobody ever said Access was designed for enterprise-level security ...



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.