Prev: On Click, Open a form, choose a selection then have it populate fi
Next: PivotTable object reference syntax
From: gagecres on 29 Apr 2010 20:30 Is there a default path to the desktop folder? I was exporting a a form from one database to another. The database I'm exporting to is on my desktop. The path is C:\Documents and Settings\Chad\Desktop\Test Database.accdb. I want to use this saved export in a macro for other people to use, but it is too specific to my PC. Is there a default path name I can use, like C:\HOME\Desktop...?
From: Allen Browne on 29 Apr 2010 21:35 Try one of these: Environ("HOMEPATH") & "\Desktop\" Environ("USERPROFILE") & "\Desktop\" -- 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. "gagecres" <gagecres(a)discussions.microsoft.com> wrote in message news:223D1F7F-63B0-4EF7-BDEC-9BB9D263F63F(a)microsoft.com... > Is there a default path to the desktop folder? I was exporting a a form > from > one database to another. The database I'm exporting to is on my desktop. > The path is C:\Documents and Settings\Chad\Desktop\Test Database.accdb. I > want to use this saved export in a macro for other people to use, but it > is > too specific to my PC. Is there a default path name I can use, like > C:\HOME\Desktop...?
From: Daniel Pineault on 30 Apr 2010 09:08 Your desktop directory is based on the currently logged in user name, so no you can't hard code a value and distribute your db and expect it to work. That said, you can easily determine the path a run-time and use it as you please. The code to do so can be found at http://www.mvps.org/access/api/api0054.htm http://www.mvps.org/access/api/api0010.htm http://msdn.microsoft.com/en-us/library/aa140088(office.10).aspx For the 1st link you'd simply call it fGetSpecialFolderLocation(CSIDL_DESKTOPDIRECTORY) -- Hope this helps, Daniel Pineault http://www.cardaconsultants.com/ For Access Tips and Examples: http://www.devhut.net Please rate this post using the vote buttons if it was helpful. "gagecres" wrote: > Is there a default path to the desktop folder? I was exporting a a form from > one database to another. The database I'm exporting to is on my desktop. > The path is C:\Documents and Settings\Chad\Desktop\Test Database.accdb. I > want to use this saved export in a macro for other people to use, but it is > too specific to my PC. Is there a default path name I can use, like > C:\HOME\Desktop...?
From: gagecres on 30 Apr 2010 12:51
Thanks. Is there a way I can call up a diaglog box or something and let the user navigate to the file themselves? "Daniel Pineault" wrote: > Your desktop directory is based on the currently logged in user name, so no > you can't hard code a value and distribute your db and expect it to work. > > That said, you can easily determine the path a run-time and use it as you > please. The code to do so can be found at > > http://www.mvps.org/access/api/api0054.htm > http://www.mvps.org/access/api/api0010.htm > http://msdn.microsoft.com/en-us/library/aa140088(office.10).aspx > > For the 1st link you'd simply call it > fGetSpecialFolderLocation(CSIDL_DESKTOPDIRECTORY) > -- > Hope this helps, > > Daniel Pineault > http://www.cardaconsultants.com/ > For Access Tips and Examples: http://www.devhut.net > Please rate this post using the vote buttons if it was helpful. > > > > "gagecres" wrote: > > > Is there a default path to the desktop folder? I was exporting a a form from > > one database to another. The database I'm exporting to is on my desktop. > > The path is C:\Documents and Settings\Chad\Desktop\Test Database.accdb. I > > want to use this saved export in a macro for other people to use, but it is > > too specific to my PC. Is there a default path name I can use, like > > C:\HOME\Desktop...? |