From: Allen Browne on
The Connect string contains several elements, e.g. it may contain user name
and password info. It seems inappropriate to go displaying that kind of
security info in the interface, hence the suggestion to Split the items and
get just the one you want.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"David W. Fenton" <XXXusenet(a)dfenton.com.invalid> wrote in message
news:Xns9D1D8195C8DD9f99a49ed1d0c49c5bbb2(a)74.209.136.89...
> "Allen Browne" <AllenBrowne(a)SeeSig.Invalid> wrote in
> news:#EwgoO6qKHA.4604(a)TK2MSFTNGP05.phx.gbl:
>
>> The GetDataPath() function here will do it for you:
>> http://allenbrowne.com/ser-53code.html#GetDataPath
>
> That's awfully convoluted, don't you think? This is a lot simpler,
> seems to me:
>
> Mid(CurrentDB.TableDefs("MyLinkedTable").Connect, 11)
>
> It returns a zero-length string when there's no connect string. For
> non-Jet linked tables, it will return an incorrect result, so you
> could do the check for this first:
>
> Left(CurrentDB.TableDefs("MyLinkedTable").Connect, 10) =
> ";DATABASE="
>
> I see that your version works for linked Jet/ACE tables and text
> files, the connect strings of which both terminate with
> ";DATABASE=Filename/path". If you don't care about text files, this
> would work:
>
> Dim strConnect As String
>
> strConnect = CurrentDb.TableDefs(strTable).Connect
> If Left(strConnect, 10) = ";DATABASE=" Then
> GetDataPath = Mid(strConnect, 11)
> End If
>
> If you want to handle as many connection types as possible without
> doing anything special, and want to avoid Split() (so it works in
> A97 without supplying a custom replacement for Split()), this would
> work:
>
> Dim strConnect As String
> Dim lngLocation As String
>
> strConnect = CurrentDb.TableDefs(strTable).Connect
> lngLocation = InStr(strConnect,";DATABASE=")
> If lngLocation <> 0 Then
> GetDataPath = Mid(strConnect, lngLocation + 10)
> End If
>
> This will work in all the same situations as your original code and
> has no dependency on Split().
>
> --
> David W. Fenton http://www.dfenton.com/
> usenet at dfenton dot com http://www.dfenton.com/DFA/

From: Allen Browne on
The functions for the Splash utility at:
http://allenbrowne.com/ser-53code.html
do return the version of MSACCESS and of JET, and the sample database shows
how to use them.

Not sure if what you mean by the version of the 'database'.

Simplest way to get the location of the current version of Access is:
SysCmd(acSysCmdAccessDir)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Paul" <BegoneSpam(a)forever.com> wrote in message
news:#5QsFdBrKHA.3792(a)TK2MSFTNGP05.phx.gbl...
> Nice functions in there, Allen. I can use the GetDataPath() function to
> get the path of the linked table, but I can also use some of those other
> functions in there to do other things like return the version of the
> database and the location of the msaccess.exe file.
>
> More treasures from your trove.
>
> Thanks much.
>
> Paul

From: Paul on
By the version of the database I was referring to the version of JET.

Thanks for the additional tip on using the SysCmd() function, Allen.


From: David W. Fenton on
"Allen Browne" <AllenBrowne(a)SeeSig.Invalid> wrote in
news:#9SIS7ErKHA.728(a)TK2MSFTNGP04.phx.gbl:

> The Connect string contains several elements, e.g. it may contain
> user name and password info. It seems inappropriate to go
> displaying that kind of security info in the interface, hence the
> suggestion to Split the items and get just the one you want.

Your code only works with the linked table formats that store
path/filename, and none of those have any extra parameters (so far
as I saw in my testing). Thus, for the cases where your code works,
my alternative also works. But my alternative is substantially
simpler.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: Allen Browne on
"Paul" <begone(a)spam.com> wrote in message
news:eI1zyaLrKHA.4492(a)TK2MSFTNGP05.phx.gbl...
> By the version of the database I was referring to the version of JET.

Ah, okay. Hopefully you found the JET version function on the same page:
http://allenbrowne.com/ser-53code.html#GetJetVersion

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Get date based on two other fields
Next: Exit ALL Subs?