Author |
Message |
Alan Queste #1 / 7
|
 Paths and App.Path
Quote:
>When I run my VB4 application from within VB, App.Path >translates to c:\vb40\projects\myproject\mydb.mdb. >When I create an executable, then run the executable from >say c:\mydir, App.Path is assigned the value c:\mydir, >which is as it should be. >However, when I reach the line MainForm.Data1.Refresh, >I receive the error: >Runtime error '3024' >Couldn't find file >c:\vb40\projects\myproject\mydb.mdb >Why does this still refer to the project directory, and NOT >the directory from where it is being executed? >Below is the code in question: > DBName = App.Path & "\" & "mydb.mdb" > Set MyWorkspace = Workspaces(0) > Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) > Set MySet1 = DBProfile.OpenRecordset("profilestable") > MainForm.Data1.Refresh
Did you fill in the database name as a hardcoded property when you placed the data control on the form? Quote: >Thanks > Bernie
|
Fri, 19 Mar 1999 03:00:00 GMT |
|
 |
Bernard Bart #2 / 7
|
 Paths and App.Path
When I run my VB4 application from within VB, App.Path translates to c:\vb40\projects\myproject\mydb.mdb. When I create an executable, then run the executable from say c:\mydir, App.Path is assigned the value c:\mydir, which is as it should be. However, when I reach the line MainForm.Data1.Refresh, I receive the error: Runtime error '3024' Couldn't find file c:\vb40\projects\myproject\mydb.mdb Why does this still refer to the project directory, and NOT the directory from where it is being executed? Below is the code in question: DBName = App.Path & "\" & "mydb.mdb" Set MyWorkspace = Workspaces(0) Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) Set MySet1 = DBProfile.OpenRecordset("profilestable") MainForm.Data1.Refresh Thanks Bernie
|
Sat, 20 Mar 1999 03:00:00 GMT |
|
 |
Michael V. Chernen #3 / 7
|
 Paths and App.Path
Barton), wrote these mellifluous words, full of wisdom and thoughtful reflections: Quote: >!<When I run my VB4 application from within VB, App.Path >!<translates to c:\vb40\projects\myproject\mydb.mdb. >!<When I create an executable, then run the executable from >!<say c:\mydir, App.Path is assigned the value c:\mydir, >!<which is as it should be. >!<However, when I reach the line MainForm.Data1.Refresh, >!<I receive the error: >!<Runtime error '3024' >!<Couldn't find file >!<c:\vb40\projects\myproject\mydb.mdb >!<Why does this still refer to the project directory, and NOT >!<the directory from where it is being executed? >!<Below is the code in question: >!< DBName = App.Path & "\" & "mydb.mdb" >!< Set MyWorkspace = Workspaces(0) >!< Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) >!< Set MySet1 = DBProfile.OpenRecordset("profilestable") >!< MainForm.Data1.Refresh
Look at the Database property of your datacontrol. I'm afraid, the string is hardcoded there. Quote: >!<Thanks >!< Bernie
|
Sat, 20 Mar 1999 03:00:00 GMT |
|
 |
Srinivas Palep #4 / 7
|
 Paths and App.Path
Quote:
> When I run my VB4 application from within VB, App.Path > translates to c:\vb40\projects\myproject\mydb.mdb. > When I create an executable, then run the executable from > say c:\mydir, App.Path is assigned the value c:\mydir, > which is as it should be. > However, when I reach the line MainForm.Data1.Refresh, > I receive the error: > Runtime error '3024' > Couldn't find file > c:\vb40\projects\myproject\mydb.mdb > Why does this still refer to the project directory, and NOT > the directory from where it is being executed? > Below is the code in question: > DBName = App.Path & "\" & "mydb.mdb" > Set MyWorkspace = Workspaces(0) > Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) > Set MySet1 = DBProfile.OpenRecordset("profilestable") > MainForm.Data1.Refresh > Thanks > Bernie
Here, I think You're using a data control named 'Data1' in MainForm for which you must have specified the databasename in the properties list at design time. So , it's resulting in this error. This is my interpretation from your code above. Check it out!!! Phani
|
Sat, 20 Mar 1999 03:00:00 GMT |
|
 |
Bernard Bart #5 / 7
|
 Paths and App.Path
Quote:
>>When I run my VB4 application from within VB, App.Path >>translates to c:\vb40\projects\myproject\mydb.mdb. >>When I create an executable, then run the executable from >>say c:\mydir, App.Path is assigned the value c:\mydir, >>which is as it should be. >>However, when I reach the line MainForm.Data1.Refresh, >>I receive the error: >>Runtime error '3024' >>Couldn't find file >>c:\vb40\projects\myproject\mydb.mdb >>Why does this still refer to the project directory, and NOT >>the directory from where it is being executed? >>Below is the code in question: >> DBName = App.Path & "\" & "mydb.mdb" >> Set MyWorkspace = Workspaces(0) >> Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) >> Set MySet1 = DBProfile.OpenRecordset("profilestable") >> MainForm.Data1.Refresh >Did you fill in the database name as a hardcoded property when you placed the data control on the >form?
Yes, that was the problem.
|
Sat, 20 Mar 1999 03:00:00 GMT |
|
 |
Mary O'Brie #6 / 7
|
 Paths and App.Path
Quote:
> When I run my VB4 application from within VB, App.Path > translates to c:\vb40\projects\myproject\mydb.mdb. > When I create an executable, then run the executable from > say c:\mydir, App.Path is assigned the value c:\mydir, > which is as it should be. > However, when I reach the line MainForm.Data1.Refresh, > I receive the error: > Runtime error '3024' > Couldn't find file > c:\vb40\projects\myproject\mydb.mdb > Why does this still refer to the project directory, and NOT > the directory from where it is being executed? > Below is the code in question: > DBName = App.Path & "\" & "mydb.mdb" > Set MyWorkspace = Workspaces(0) > Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) > Set MySet1 = DBProfile.OpenRecordset("profilestable") > MainForm.Data1.Refresh > Thanks > BernieHi Bernie,
Am I missing something? I don't see where you are setting the databaseName property of the data control. If you can set the databaseName property at design time so you can set up all the bound controls with the appropriate fields. Then set Enabled = False. When the program is run have code to set the Data1.DatabaseName = App.Path & "myfile" and set enabled to true. HTH
|
Wed, 24 Mar 1999 03:00:00 GMT |
|
 |
A. R. Endalwag #7 / 7
|
 Paths and App.Path
Quote: >However, when I reach the line MainForm.Data1.Refresh, >I receive the error: >Runtime error '3024' >Couldn't find file >c:\vb40\projects\myproject\mydb.mdb >Why does this still refer to the project directory, and NOT >the directory from where it is being executed? >Below is the code in question: > DBName = App.Path & "\" & "mydb.mdb" > Set MyWorkspace = Workspaces(0) > Set DBProfile = MyWorkspace.OpenDatabase(DBName, False, False) > Set MySet1 = DBProfile.OpenRecordset("profilestable") > MainForm.Data1.Refresh
Try this: MainForm.Data1.DatabaseName = App.Path & "\mydb.mdb" MainForm.Data1.Recordsource = "profilestable" Regards Ray
|
Wed, 24 Mar 1999 03:00:00 GMT |
|
|
|