-
Jun 7th, 2021, 07:03 AM
#1
Thread Starter
New Member
[RESOLVED]isn't a valid path error
Hello everybody,
I just started to work on an ancient VB 6.0 code and get an "isn't a valid path" error. Im fairly new in VB6.0 and cannot solve it. This program made by CEO in 2001 and he want me to "get rid of the errors".
I posted the error .png. It check the "c:\work\design\cable.mdb" path but when i click "ok" button it will work just fine cause it uses the cable.mdb where the program actually are( like G:\focd\cable.mdb)
Im have been working on it for 4 days and cannot find any suitible answer. Just want to get rid off the error.
I use win10 fyi. Thanks in advance.
Last edited by killtheflux; Jun 8th, 2021 at 01:32 AM.
-
Jun 7th, 2021, 07:14 AM
#2
Re: isn't a valid path error
A bit confusing...but....
If your database (.mdb file) is located at G:\focd\, then, in the code, FIND the string "C:\Work\Design\cable.mdb" and replace it with "G:\focd\cable.mdb".
However, using Hard-Coded paths (if that has been done in the app), is not a good practice.
Sam
PS- Welcome to the Forum.
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 07:21 AM
#3
Thread Starter
New Member
Re: isn't a valid path error
Thank you for your reply Sam,
Program uses the database where the program is. G:\focd is just and example. It does not use the "C:\Work\Design\cable.mdb" database but it will check everytime. I guess, somehow, somebody hardcodded it. Cause there is no "C:\Work\Design\cable.mdb" or any other permutation of it in the code. Not even "c:".
I hope these information make problem more clear.
-
Jun 7th, 2021, 07:30 AM
#4
Re: isn't a valid path error
1-did you do a GLOBAL search (Current Project option selected After CNTRL-F)?
2-You said that the program RUNS okay, but throws that error? Meaning, after you select Tamam (Okay), it runs fine?
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 07:36 AM
#5
Re: isn't a valid path error
Does the app use an ADODC Control? (Look under Components (Right mouse on the ToolBox, and select components)...see if the Microsoft ADO Data Control is checked.)
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 07:36 AM
#6
Member
Re: isn't a valid path error
If you can't find "C:\Work\Design" in the code it may be taken from some INI-file or registry key. Look for commands reading from registry or ini's. You can also search for the path in the registry or in files on the PC where it works. The reason that it works anyway may be that it falls back on the application folder if not found in the specified path.
-
Jun 7th, 2021, 07:38 AM
#7
Thread Starter
New Member
Re: isn't a valid path error
1- Yes (now i did it again)
2- Yes
it really bothers me. I dont know what i miss.
-
Jun 7th, 2021, 07:39 AM
#8
Re: isn't a valid path error
@Tomas....as it appears ktf is new to VB6, maybe you should provide examples of what he should be looking for (reading from registry or ini's).
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 07:52 AM
#9
Thread Starter
New Member
Re: isn't a valid path error
You are right i'm fairly new to vb6. but i got c# and python experience so they give me a brief idea. I thought that problem causes in this part but i cannot find any evidence. Attachment 181604
-
Jun 7th, 2021, 07:56 AM
#10
Member
Re: isn't a valid path error
Try to search the code for the following strings to find code that reads from the registry or an ini settings file:
RegOpenKey
GetPrivateProfileString
GetSetting
ini
-
Jun 7th, 2021, 07:56 AM
#11
Re: isn't a valid path error
The message seems to be generated by Visual Basic itself, because the Caption normally contains the name of the project and not a generic text like "Microsoft Visual Basic"
What kind of components does the application use?
DataReport? Crystal Reports?
If you have the source code, then you should be able to debug it.
-
Jun 7th, 2021, 08:08 AM
#12
Member
Re: isn't a valid path error
I think I know where it comes from. I was able to repeat the error by adding the "data" control to a form and set the path to a non existing mdb file in its "DatabaseName" property. Look for the the Data control on your forms and you may find the path. Remove the path from the DatabaseName property and leave it empty (or point it to the actual location of the file). This should get rid of the error message.
The control looks the like this:
Last edited by TomasEss; Jun 7th, 2021 at 08:29 AM.
-
Jun 7th, 2021, 08:11 AM
#13
Re: isn't a valid path error
at Arnie...yeah, my first thought was hardcoded paths. My second was components (where path's are chosen when setting them up). I believe OP said YES to it have an ADODC. IF that is the case, select the ADODC in the IDE and look at its properties. The 'path' is probably there. But if the app works (as it also appears once Tamam is selected), then that ADODC control is probably not even being used any more, and could then be removed from the project.
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 08:28 AM
#14
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by TomasEss
Try to search the code for the following strings to find code that reads from the registry or an ini settings file:
RegOpenKey
GetPrivateProfileString
GetSetting
ini
there is only this line
Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
@arnoutdv
Actually i dont know what kind of components do we use. Also i dont know how to check it. I have the projects design folder so i guess it is the source code but i cannot debug it properly cause my lack of knowledge of vb6.
@TomasEss
Can you upload your attachment again?
i really dont find the path location. there is no locations as c:\work\design or anything that goes there. if i found it i definetly changed it.
@samoscarbrown
In the components screen in IDE, nothing is thicked. So i assume nothing is used.
-
Jun 7th, 2021, 08:31 AM
#15
Member
Re: isn't a valid path error
@TomasEss
Can you upload your attachment again?
Now the attachment should be seen in my post above.
-
Jun 7th, 2021, 08:32 AM
#16
Re: isn't a valid path error
Try doing a text search of the folder in explorer. This should find the culprit if it is in code, a property or even an external file so long as it is in the project folder.
And there are default objects in the tool box that can be added to forms without ticking any additional components. Ticking items there adds more items to the toolbox in addition to the ones there by default.
-
Jun 7th, 2021, 08:40 AM
#17
Re: isn't a valid path error
If I may suggest a good search utility, try Agent Ransack. I have used to search multiple file quickly and easily. It also works great at finding strings in binary files.
-
Jun 7th, 2021, 08:44 AM
#18
Re: isn't a valid path error
In the components screen in IDE, nothing is thicked. So i assume nothing is used.
I'm assuming you meant 'Checked". Did you do a right-mouse on the toolbox, and bring up a "Components Screen"? If you did, and nothing is checked, then that is not the issue. (You can see WHAT is included for 'extra' components by selecting the "Select Items Only" checkbox.)
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 08:50 AM
#19
Re: isn't a valid path error
Oh, and just to completely eliminate the fact that an ADODC is in the project or not, in Windows Explorer, right mouse on each FORM name (forms end in .frm) and OPEN WITH NotePad. Search for "ADODC"...if its there, you have the control on that form...so, if you find it, go to that form and select the control (an image was provided earlier by another) and look at its properties to see if the path is there.
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 08:55 AM
#20
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by SamOscarBrown
I'm assuming you meant 'Checked". Did you do a right-mouse on the toolbox, and bring up a "Components Screen"? If you did, and nothing is checked, then that is not the issue. (You can see WHAT is included for 'extra' components by selecting the "Select Items Only" checkbox.)
yes i meant "checked". Nothing is checked.
@datamiser
i did search and there is nothing relevant to the path. only the code block that i attached.
@tomasess
there is no such thing as control like the attachment in your reply.
Thank you all for your patience. i hope we manage this out.
-
Jun 7th, 2021, 09:04 AM
#21
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by SamOscarBrown
Oh, and just to completely eliminate the fact that an ADODC is in the project or not, in Windows Explorer, right mouse on each FORM name (forms end in .frm) and OPEN WITH NotePad. Search for "ADODC"...if its there, you have the control on that form...so, if you find it, go to that form and select the control (an image was provided earlier by another) and look at its properties to see if the path is there.
I checked every form and there is no ADODC in any form.
-
Jun 7th, 2021, 09:21 AM
#22
Re: isn't a valid path error
Are you runnng the app from the IDE, or the .exe file?
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 09:32 AM
#23
Re: isn't a valid path error
Originally Posted by killtheflux
@datamiser
i did search and there is nothing relevant to the path. only the code block that i attached.
Did you search the way I suggested or did you as I assumed search within the VB editor?
Note that the VB editor only searches the code text of the project.
Searching the folder using explorer or other tool searches all files in the folder and in the case of form file not only searches the code but all property settings as well.
You definitely have that text in there somewhere, either it is in code, a property setting, or in an external file or db.
The only other possibility I can think of is that you have a DSN setup and pointed to that path that you app is making a call to.
-
Jun 7th, 2021, 09:34 AM
#24
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by SamOscarBrown
Are you runnng the app from the IDE, or the .exe file?
from the ide. But also .exe gives the same error.
-
Jun 7th, 2021, 09:35 AM
#25
Re: isn't a valid path error
I would assume you cannot zip your entire project (less the database(s) and .exe file) and post it here. Just a suggestion if you can.
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 09:40 AM
#26
Member
Re: isn't a valid path error
I agree with @DataMiser that you should be able to find it in a text search.
If the data control I've mentioned is placed outside visible parts of the forms you may have missed it if looking through them visually. If the text search fails to find it, try to open each file in notepad (forms *.frm first I suggest) and search them. In my test, that recreates the error message, my form1.frm looks like this in notepad:
-
Jun 7th, 2021, 09:55 AM
#27
Thread Starter
New Member
-
Jun 7th, 2021, 09:57 AM
#28
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by SamOscarBrown
I would assume you cannot zip your entire project (less the database(s) and .exe file) and post it here. Just a suggestion if you can.
i may but i think my boss doesnt like it
-
Jun 7th, 2021, 10:31 AM
#29
Re: isn't a valid path error
i may but i think my boss doesnt like it
Hee hee....gotcha.
Well, first, try changing all three strings to the location of YOUR mdb file.
Let us know...if that doesn't work, we'll advise.
Sam I am (as well as Confused at times).
-
Jun 7th, 2021, 10:32 AM
#30
Re: isn't a valid path error
Sorry....look at those forms in the IDE....find the 'thing' called Data, with a name of Data1 (should find in the properties listing of controls (on the right (normally)) in the IDE.
Sam I am (as well as Confused at times).
-
Jun 8th, 2021, 12:49 AM
#31
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by SamOscarBrown
Sorry....look at those forms in the IDE....find the 'thing' called Data, with a name of Data1 (should find in the properties listing of controls (on the right (normally)) in the IDE.
ok, i found it thank you. Now i want to set it to the folder to the Google Drive but it gives another error. Another option is setting this adress to the same one as where .exe sits. But these are "static" is it possible to change that to the .exe's folder. Everybody uses different folder in their computers.
-
Jun 8th, 2021, 01:02 AM
#32
Re: isn't a valid path error
Data files should go into the special folder application data. They should not go in the same folder as the exe. If the exe is install under program files as is the norm then you will get access errors trying to open the files for write access as that is a restricted location.
-
Jun 8th, 2021, 01:31 AM
#33
Thread Starter
New Member
Re: isn't a valid path error
Originally Posted by DataMiser
Data files should go into the special folder application data. They should not go in the same folder as the exe. If the exe is install under program files as is the norm then you will get access errors trying to open the files for write access as that is a restricted location.
ooohh i see. thank you.
Thank you all, its now working. I guess i will manage further. Love you. <3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|