Results 1 to 33 of 33

Thread: [RESOLVED]isn't a valid path error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Resolved [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.

    Name:  Error.PNG
Views: 972
Size:  8.1 KB
    Last edited by killtheflux; Jun 8th, 2021 at 01:32 AM.

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    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.

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  6. #6
    Member
    Join Date
    Dec 2011
    Location
    Stockholm, Sweden
    Posts
    45

    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.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    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.

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    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

  10. #10
    Member
    Join Date
    Dec 2011
    Location
    Stockholm, Sweden
    Posts
    45

    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

  11. #11
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    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.

  12. #12
    Member
    Join Date
    Dec 2011
    Location
    Stockholm, Sweden
    Posts
    45

    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:
    Name:  datacontrol.jpg
Views: 826
Size:  7.6 KB
    Last edited by TomasEss; Jun 7th, 2021 at 08:29 AM.

  13. #13
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  14. #14

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by TomasEss View Post
    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.

  15. #15
    Member
    Join Date
    Dec 2011
    Location
    Stockholm, Sweden
    Posts
    45

    Re: isn't a valid path error

    @TomasEss

    Can you upload your attachment again?
    Now the attachment should be seen in my post above.

  16. #16
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    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.

  17. #17
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,807

    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.

  18. #18
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  19. #19
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  20. #20

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by SamOscarBrown View Post
    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.

  21. #21

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by SamOscarBrown View Post
    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.

  22. #22
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  23. #23
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: isn't a valid path error

    Quote Originally Posted by killtheflux View Post
    @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.

  24. #24

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by SamOscarBrown View Post
    Are you runnng the app from the IDE, or the .exe file?
    from the ide. But also .exe gives the same error.

  25. #25
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  26. #26
    Member
    Join Date
    Dec 2011
    Location
    Stockholm, Sweden
    Posts
    45

    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:
    Name:  datacontroltest.jpg
Views: 769
Size:  48.7 KB

  27. #27

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    sorry i misunderstood something. i searched the word "ADODC" but now searched "c:\work" and FIND in 3 FORMS PALS, now whats next
    Name:  coreform.jpg
Views: 811
Size:  26.9 KB

  28. #28

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by SamOscarBrown View Post
    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

  29. #29
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  30. #30
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    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).

  31. #31

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by SamOscarBrown View Post
    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.

  32. #32
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    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.

  33. #33

    Thread Starter
    New Member
    Join Date
    Jun 2021
    Posts
    12

    Re: isn't a valid path error

    Quote Originally Posted by DataMiser View Post
    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
  •  



Click Here to Expand Forum to Full Width