Results 1 to 9 of 9

Thread: Tracking Access Database after Installation

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 1999
    Posts
    44

    Post

    How can I have VB6 to keep track of the path for a Access Database after installation of a program?

    I would apperciate any help!

    Lloyd

  2. #2
    New Member
    Join Date
    May 1999
    Location
    London, United Kingdom
    Posts
    4

    Post

    you need to modify the setup1 project, and then recompile Setup1.exe - before building you distribution set (cab files etc).

    In VB open the setup1 project. open form : 'frmSetup1'. Go to code window.

    In the Form_Load event, after 'gstrFontDir' add following code:

    '********************************************
    'Save information to the Registery

    Dim strSrcDrv As String 'Source Drive Letter
    Dim strDstDrv As String ' Destination Drive Letter
    Dim strDstPth As String ' Destination Path
    Dim strDstDrvPth As String

    strDstDrv = UCase(Left(gstrDestDir, 1))
    strDstPth = UCase(Mid(gstrDestDir, 4))

    SaveSetting appname:="MyApp", section:="Drives", Key:="MyDatabase", setting:=strDstDrv & ":\" & strDstPth & "Mydatabase.mdb"
    '********************************************

    If you include the database in the list of files (package & deployment wiz), the above code will ensure that the registry stores the location of the mdb.

    In your program, you will need to use GetSetting, to re-connect data-controls to correct path.

    Above does not cater for users moving databases from installation path. So, add a function like:

    Private Function FileExists(FileName) As Boolean
    'This function designed to Test for exisitience of all databases required
    On Error GoTo FileNameErr
    FileExists = (Dir(FileName) <> "")
    Exit Function
    FileNameErr:
    MsgBox "The program needs to be reinstalled - it cannot find the database files needed at :' " & FileName & " '. The program will now terminate."
    End Function

    ...where FileName is name of database - retrieved from the registry.

    Good Luck

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 1999
    Posts
    44

    Post

    Thanks I apperciate the help!!!!!!!!

    Lloyd

  4. #4
    Lively Member
    Join Date
    Jun 2001
    Location
    St-Hubert, Quebec, Canada
    Posts
    70
    NMahon I'm lost.....
    you say "In VB open the setup1 project. open form : 'frmSetup1'. Go to code window.

    In the Form_Load event, after 'gstrFontDir' add following code:"

    How do you open setup1 which is an exe?
    If you mean my project file . . . I don't have 'frmSetup1' . . .

    pleeze enlighten me
    Elvis is in the house!

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Wouldn't it be easier to modify the path in the P&D wizard when
    your are packaging it? Just enter an additional subdirectory or
    just put it in any on the dropdown selection path macros like
    apppath or programfiles.

    Then when your program starts you can populate your
    connection string with that path. Ex. app.path.



    HTH
    Attached Images Attached Images  
    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

  6. #6
    Here's an Idea that I use.

    Some of the times the end user needs to, or wants to, place the database where they want it to be.

    So I create an .INI file that store's the locations of the database and have my program read the .INI file. This way they can change it when ever they need to and your program will always know the location.

    This is just one of the means that I use. You may wish to do other wise.
    David M. Camp

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Yes, I have used that method also, but I think they are talking
    about the first run of the program after its installed. They want to
    know how to determine the location of the db for the first time.

    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

  8. #8
    Lively Member
    Join Date
    Jun 2001
    Location
    St-Hubert, Quebec, Canada
    Posts
    70
    Thanx for the ideas guys . . .we're headed in the right direction. But maybe I'm doing things backwards and you have a better way.
    I package an MDB file with my app, if the person reinstalls then I don't want the package to overwrite the existing database just simply update the exe.
    I know I can write two packages, one with mdb and one without mdb and have person select his download preference.
    But, I was thinking of having just one package including mdb and have the installation program query the user if he'd like to keep his existing database or overwrite it during the installation process.
    Any ideas?
    Elvis is in the house!

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    First thing that comes to mind is to alter the setup1.vbp and
    compile a new setup project. Add a form in there to designate
    installing a new database or have them browse to the location of
    an existing one.

    HTH
    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

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