473,320 Members | 2,189 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to get Acc2003 to default to current directory?

8,435 Expert 8TB
Hi all.

Is there any way to tell Access 2003 (and/or 2000) to default to the current directory where I started it? Every time I open a database and go to do an Import or whatever, the damned thing starts in My Documents.

I don't think the "default database folder" option is likely to be any use, unless there's some way to set it dynamically to point to the current (or "working") folder.

Not crucial, of course, just very annoying.
Nov 7 '06 #1
5 5668
ADezii
8,834 Expert 8TB
Hi all.

Is there any way to tell Access 2003 (and/or 2000) to default to the current directory where I started it? Every time I open a database and go to do an Import or whatever, the damned thing starts in My Documents.

I don't think the "default database folder" option is likely to be any use, unless there's some way to set it dynamically to point to the current (or "working") folder.

Not crucial, of course, just very annoying.
'This little Code snippet will automatically change the Current Directory to the
'Directory where Msaccess.exe is located. I know it's not exactly what you
'wanted, but it may point you in the right direction. Hope it helps..

Dim varRet
Expand|Select|Wrap|Line Numbers
  1. varRet = SysCmd(acSysCmdAccessDir)
Expand|Select|Wrap|Line Numbers
  1. ChDir varRet
Nov 7 '06 #2
Killer42
8,435 Expert 8TB
'This little Code snippet will automatically change the Current Directory to the 'Directory where Msaccess.exe is located. I know it's not exactly what you 'wanted, but it may point you in the right direction. Hope it helps..
Dim varRet
Expand|Select|Wrap|Line Numbers
  1. varRet = SysCmd(acSysCmdAccessDir)
Expand|Select|Wrap|Line Numbers
  1. ChDir varRet
Thanks ADezii.

You're right, it's not exactly what I was after, but is certainly a helpful idea. I could run something similar from an Autoexec macro, at the least. I'll give it a shot and let you know how it goes.
Nov 7 '06 #3
Killer42
8,435 Expert 8TB
Well, it's not particularly elegant, but it works.

I placed RunCode FixTheStupidDefault ( ) in my AutoExec macro, and in that Function, just did ChDir to a hard-coded path. Works like a charm. What I need to do now, of course, is to decide how I'm going to choose what path to put in there. Admittedly most of my Access work is in the same path, but not all.

Hm... I might try investigating things such as the FullPath property - if I get the path+name for the current database, I can extract the path and use that. I'm better in VB, not that familiar with the object model in Access. But I'll get it...
Nov 7 '06 #4
Expand|Select|Wrap|Line Numbers
  1. DefaultWorkingDirectory = Application.GetOption("Default Database Directory")
  2.  
  3. Application.SetOption "Default Database Directory", getFilePath(strFullName)
  4.  
  5. Function getFilePath(ByVal fullFileName As String) As String
  6.    Dim sFileName As String, RevPath As String
  7.    sFileName = StrRev(fullFileName)
  8.    RevPath = Mid(sFileName, InStr(1, sFileName, "\"))
  9.    getFilePath = StrRev(RevPath)
  10. End Function
  11.  
  12. Function StrRev(ByVal sData As String) As String
  13.    Dim i As Integer
  14.    Dim sOut As String
  15.    sOut = ""
  16.    For i = 1 To Len(sData)
  17.       sOut = Mid(sData, i, 1) & sOut
  18.    Next i
  19.    StrRev = sOut
  20. End Function
default database directory stored in windows registery in this key:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\A ccess\Settings
Default Database Directory --> REG_SZ --> E:\Database\Access\
Jan 15 '15 #5
anvidc
28
You may try this
Expand|Select|Wrap|Line Numbers
  1. Application.CurrentProject.Path
Jan 16 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JMCN | last post by:
hello- i have created a tabular form using records from a specific query. then users will filter out the specific data. the next step is to take the count of the current records (daily open...
4
by: First Tiger | last post by:
Is there a default function or global variable that will allow me to derive the location of my install? I'm trying to store my system settings file from a persistent location. I know that I can set...
6
by: Lenn | last post by:
Hi, I have a DLL with unmanaged function written in C. I need to call from managed C# code, where should DLL have to placed, bin folder system32? And can this location be changed. I haven't...
2
by: planetthoughtful | last post by:
Hi All, I'd like to place a subreport onto a report that draws its records from a UNION query. When I design the query and view the records all looks fine. However, when I put the query as...
3
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current...
62
by: Tony Ciconte | last post by:
I have a rather complex commercial Acc2003 application (tab controls, 50K+ lines of VBA code, etc.) that will not run well at all on Windows Vista Ultimate. I have seen posts indicating that...
8
by: T. Crane | last post by:
Hi, How is the default path chosen in this instance: myFile = file('test.txt','w') Here I'm opening/creating a file but I have not specified the exact path, so how does Python determine...
2
by: Stef Mientki | last post by:
Terry Reedy wrote: thanks Terry and others, brings me to one other question: I guess this function is only evaluated once, is that correct ? about os.curdir, I checked it, it's already a...
15
denny1824
by: denny1824 | last post by:
I have a working website. I copied all the files to a new folder in inetpub/wwwroot and then set that folder as a Virtual Directory in IIS. I try going to that site from the new folder and i am...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.