Results 1 to 21 of 21

Thread: Deployment Question--where to put file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Resolved Deployment Question--where to put file

    Problem: When I install the application it can't find my access file.

    I have several forms in my project, on 2 of them I have a data sources both with an access file located in c:\nada\temp\question.mdb.

    How do I handle those when installing on another computer. I'm using Visual Studio Installer, and am very unclear on how to properly handle this.

    Does the installer have to create a file exactly as I have coded it, or should I be coding it differently, or do I not know what I'm doing with the VSInstaller.

    Thanks---obvious newbie here

    Last edited by brainhurts; Jul 11th, 2005 at 03:23 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Deployment Question--where to put file

    Sounds like your "hard coding" your db path. Dont, use a relative path if the db is going to be in the exe's directory.
    What is your app written in? VB6/VB.NET, etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Deployment Question--where to put file

    Quote Originally Posted by brainhurts
    Problem: When I install the application it can't find my access file.

    I have several forms in my project, on 2 of them I have a data sources both with an access file located in c:\nada\temp\question.mdb.

    How do I handle those when installing on another computer. I'm using Visual Studio Installer, and am very unclear on how to properly handle this.

    Does the installer have to create a file exactly as I have coded it, or should I be coding it differently, or do I not know what I'm doing with the VSInstaller.

    Thanks---obvious newbie here

    how many persons will be using the database at one time? If more than 5 or 10 I would suggest you consider upgrading to a real db server such as MySQL, MSDE or Postgre, all of which are open source (read FREE!!). Then you can connect to these DB via an ODBC Connection. Access was designed to be a desktop application and not a network application.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    I'm using VB6. This will be a 1 person at a time application. Users will operate from their own database.

    "Sounds like your "hard coding" your db path. Dont, use a relative path if the db is going to be in the exe's directory."


    How do I do that?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    Anyone? How do I use a relative path in the exe's directory?

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Deployment Question--where to put file

    I'm back. Hard coding the paths is like when you put the path in your connection string that is related to your systems path.
    Then when you install to another system with a different path it will error.

    A relative path would be like using the App.Path function. It retrieves the path of where you app is located. So if you install your db
    to the same folder as you exe you will always be able to know the path on any system its installed to.

    How are you connecting to the DB? ADO, DAO, ODBC, etc. Can you post your connection code?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    Okay i'm a little confused. My connection code? ummm..you mean this?

    Dim WRdb As Database, WRTable As Recordset
    Set WRdb = Workspaces(0).OpenDatabase("\\Zac\Visual Basic6\DirtBike\moto")
    ' Open table.
    Set WRTable = WRdb.OpenRecordset("mototable", dbOpenTable)

    This is just me opening my db which is obviously stored in above folder.
    The properties of my data source are also linked to the above folder.
    I understand the concept of having the db file in the same place as the exe, but I need a little coddling here..picture, step by step or hammer.

    'please pardon me as i'm a self taught newbie with no formal training!

    Thanks for helping me

  8. #8
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Deployment Question--where to put file

    If you have your DB in the same directory as the .exe you could use:

    Dim WRdb As Database, WRTable As Recordset
    Set WRdb = Workspaces(0).OpenDatabase(App.Path & "\moto")
    ' Open table.
    Set WRTable = WRdb.OpenRecordset("mototable", dbOpenTable)


    That should work but I am kinda a rookie too.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Deployment Question--where to put file

    So your using DAO. If all users are running the db locally (on their system) then the app.path suggestion is the way to go.
    Besoup posted correct code. The thing is that if you dont have a share called "Visual Basic6" then the path is invalid. Its not a
    filesystem path unless you use the Admin share like - "\\Zac\C$\Visual Basic6\DirtBike\moto".
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    okay...what do I put as the database name in properties? Just moto? moto.mdb? \\moto?...etc?

    thanks

  11. #11
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Deployment Question--where to put file

    I open them using the file extension. IE) App.Path & "\moto.mdb"

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    I had already tried that, it tells me file not valid when I run it. Do I actually need to install the program and run it for it to work? That can't be right!!!!!

    ----------pulling hair-----------------

    I tried just almost every combination for the database name---nothing working..i must have something else wrong in my project!!!

  13. #13
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Deployment Question--where to put file

    add msgbox app.path

    to find out where its pointing and edit your line based on that

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    It's going to c:\Zac\Visual Basic6\DirtBike\...which is the same folder as my exe. Which is exactly my problem. When I install this on someone else machine this won't work.

    The database opens using the app path code BESOUP recommended, but won't work on someone else's machine with the database name as c:\zac\etc\etc....

  15. #15
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Deployment Question--where to put file

    as long as you have the .mdb in the same directory relevant to the executable, app.path should suffice.

    If it were on someone elses pc, the path could very well be "C:\Program Files\Travis Smith"

  16. #16
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Deployment Question--where to put file

    Quote Originally Posted by brainhurts
    It's going to c:\Zac\Visual Basic6\DirtBike\...which is the same folder as my exe. Which is exactly my problem. When I install this on someone else machine this won't work.

    The database opens using the app path code BESOUP recommended, but won't work on someone else's machine with the database name as c:\zac\etc\etc....
    Ok so you are installing the App without the DB on other machines? If that is the case you just need to make sure your DB is in a shared directory ie. "\\Zac's Computer\Visual Basic6\Dirtbike\....."

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    Here's a visual of my prob.
    Attached Images Attached Images   

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    Quote Originally Posted by Besoup
    Ok so you are installing the App without the DB on other machines? If that is the case you just need to make sure your DB is in a shared directory ie. "\\Zac's Computer\Visual Basic6\Dirtbike\....."

    No...no..that's what I need to do. The app and the DB will be installed on other machines.

  19. #19
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Deployment Question--where to put file

    Quote Originally Posted by brainhurts
    Here's a visual of my prob.

    My original solution was only good if you were packaging and deploying the DB with the application. If you are having all your users access the same database through a LAN, you will have to use the full path of the shared directory that you will be keeping it.

  20. #20
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Deployment Question--where to put file

    Quote Originally Posted by brainhurts
    No...no..that's what I need to do. The app and the DB will be installed on other machines.
    Ok then if that is the case you could add a line on the form_load event like:

    VB Code:
    1. Data1.DatabaseName = App.Path & "\moto.mdb"

    And leave it blank in the properties of Data1.

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    Re: Deployment Question--where to put file

    Awesome...that was the magic I was looking for!!!

    Thanks all..Problem Resolved

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