
03-10-2002, 10:48 PM
|
|
Original Contributor
Retired Moderator * Guru *
|
|
Join Date: Jan 2001
Location: Watch Window
Posts: 2,781
|
|
Hi Sara
It looks like you solved your problem but I would like to point out a potential bug with your code:
App.Path has a well known bug with the slash at the end of the path. If the app is in a root directory like A:\, C:\, D:\, etc... then a slash will be returned at the end but if it is in a folder then no slash will be returned at the end. This will cause a run time error if you hard code the slash when your app is run from a root directory.
You can use this code to fix the bug. Just refer to AppPath instead of App.Path.
Code:
Option Explicit
Private AppPath As String 'use this instead of App.Path
Private Sub Form_Load()
AppPath = App.Path
If Right$(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
End Sub
Good Luck
JDT
|
|