Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Finding Current mdb or mde name & folder

Geek News

Finding Current mdb or mde name & folder
Trever B 12/7/2005 8:03:01 AM
Hi, Thanks in advance.

Need to know the current database name and file extension. Together with
folder name. I need the following stings completing as an example.

do action here to find:-

mydbfile = "test"
mydbext = "mdb"
mydbfolder = "c:\Database\Current\"

Thanks once again


trev
Re: Finding Current mdb or mde name & folder
"Brendan Reynolds" <brenreyn[ at ]discussions.microsoft.com> 12/7/2005 12:26:44 PM
Assuming Access 2000 or later. I'm also assuming only one "." in the name -
if you can't make that assumption, you'll need to modify the example a bit
to look for the extension in the last element of the array.

Public Sub DbInfo()

Dim varWork As Variant
varWork = Split(CurrentProject.Name, ".")
Debug.Print "Name: " & varWork(0)
Debug.Print "Ext: " & varWork(1)
Debug.Print "Path: " & CurrentProject.Path & "\"

End Sub

If you're using Access 97, CurrentDb.Name will give the full path and name,
including extension, and you can parse it from there.

--
Brendan Reynolds


"Trever B" <TreverB[ at ]discussions.microsoft.com> wrote in message
news:2F2B2197-9C93-4B5C-A624-A49FDCB15A64[ at ]microsoft.com...
[Quoted Text]
> Hi, Thanks in advance.
>
> Need to know the current database name and file extension. Together with
> folder name. I need the following stings completing as an example.
>
> do action here to find:-
>
> mydbfile = "test"
> mydbext = "mdb"
> mydbfolder = "c:\Database\Current\"
>
> Thanks once again
>
>
> trev


Re: Finding Current mdb or mde name & folder
Stephen sjw_ost 12/16/2008 8:43:21 PM
How to add/insert this info into a table for tracking purposes?
Thanks.

"Brendan Reynolds" wrote:

[Quoted Text]
> Assuming Access 2000 or later. I'm also assuming only one "." in the name -
> if you can't make that assumption, you'll need to modify the example a bit
> to look for the extension in the last element of the array.
>
> Public Sub DbInfo()
>
> Dim varWork As Variant
> varWork = Split(CurrentProject.Name, ".")
> Debug.Print "Name: " & varWork(0)
> Debug.Print "Ext: " & varWork(1)
> Debug.Print "Path: " & CurrentProject.Path & "\"
>
> End Sub
>
> If you're using Access 97, CurrentDb.Name will give the full path and name,
> including extension, and you can parse it from there.
>
> --
> Brendan Reynolds
>
>
> "Trever B" <TreverB[ at ]discussions.microsoft.com> wrote in message
> news:2F2B2197-9C93-4B5C-A624-A49FDCB15A64[ at ]microsoft.com...
> > Hi, Thanks in advance.
> >
> > Need to know the current database name and file extension. Together with
> > folder name. I need the following stings completing as an example.
> >
> > do action here to find:-
> >
> > mydbfile = "test"
> > mydbext = "mdb"
> > mydbfolder = "c:\Database\Current\"
> >
> > Thanks once again
> >
> >
> > trev
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net