PC Review


Reply
Thread Tools Rate Thread

Database Path

 
 
jamesker@uvic.ca
Guest
Posts: n/a
 
      7th Apr 2008
Hi,

I am trying to find the path that the my database is in using VB.
example

dim dbPath as string
dbPath = currentDatabase.path

I know this is incorrect code and I don't know how to write the
correct code. To do the same thing in Excel is as follows:

dbPath = ThisWorkbook.Path

Does anyone know how to do this?? thanks.
 
Reply With Quote
 
 
 
 
aaron.kempf@gmail.com
Guest
Posts: n/a
 
      7th Apr 2008
currentDb.path

-Aaron



On Apr 7, 2:00*pm, james...@uvic.ca wrote:
> Hi,
>
> I am trying to find the path that the my database is in using VB.
> example
>
> dim dbPath as string
> dbPath = currentDatabase.path
>
> I know this is incorrect code and I don't know how to write the
> correct code. To do the same thing in Excel is as follows:
>
> dbPath = ThisWorkbook.Path
>
> Does anyone know how to do this?? *thanks.


 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      7th Apr 2008
Aaron's incorrect: there's no Path property for the CurrentDb object.

CurrentDb.Name will give you the full path to the file. You can retrieve
only the path using:

Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))

Alternatively, Access 2000 and newer have Application.CurrentProject.Path

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


<(E-Mail Removed)> wrote in message
news:33ae0772-6eb4-4ad5-afba-(E-Mail Removed)...
> Hi,
>
> I am trying to find the path that the my database is in using VB.
> example
>
> dim dbPath as string
> dbPath = currentDatabase.path
>
> I know this is incorrect code and I don't know how to write the
> correct code. To do the same thing in Excel is as follows:
>
> dbPath = ThisWorkbook.Path
>
> Does anyone know how to do this?? thanks.



 
Reply With Quote
 
jamesker@uvic.ca
Guest
Posts: n/a
 
      7th Apr 2008
awesome, thanks doug
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Path =?Utf-8?B?TXVrZXNo?= Microsoft Access 6 28th Feb 2008 12:52 AM
Could not find <back end database path> database's startup message =?Utf-8?B?RG91Ymxl?= Microsoft Access VBA Modules 5 5th Jun 2007 11:38 PM
RE: Could not find <back end database path> database's startup message =?Utf-8?B?RG91Ymxl?= Microsoft Access VBA Modules 0 3rd Feb 2006 11:43 AM
Database Path D. A. Gray Microsoft Access VBA Modules 0 1st Aug 2003 06:34 PM
Re: Database Path Allen Browne Microsoft Access VBA Modules 1 1st Aug 2003 01:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 AM.