Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Best way to accomplish this task?

Posted on 2016-09-07
3
Medium Priority
?
115 Views
Last Modified: 2016-09-08
We have an access database, which is being used by multiple police departments.  The database is split front-end/back-end.  The backend sits on the department's servers.  The front-end sits on the client machine with a .txt file that shows the path to the backend.  The front-ends are not installed in the same directory on each client.

I am creating a vb.net application which will do some importing into the access database.  Since each department has different locations where the front end and back end sit, what would the easiest way to get the location of the backend so I can connect to it through the vb.net and accomplish what I need to do?

Do I do a search for the .txt file that shows the location of the back-end?  I believe that would take a long time to accomplish.  Do I create an application for each department individually?  I would rather stay away from that due to update on future code.
0
Comment
Question by:K-9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
WalkaboutTigger earned 2000 total points
ID: 41788184
Here is what I would do:

First round of "update" application searches the drive for the TXT file then stores it in an appropriate location in either HKLM or HKCU in the registry - HKLM\Software\PDDatabase\DBLocation and a key, TextFile. which contains the quoted path to the text file, including the files name.

Subsequent updaters can see if the registry key exists and, if not, search the drive and write the key.  If it finds the key, it verifies the location of the file and tests to ensure it can connect to the backend server with the information from the text file.

I would say that keeping the information in the registry would, in the long term, be a better place than a TXT file or an INI file, but having the location of the text file stored in a known, programmatically-controllable location is a decent compromise.

One thing about the search for the TXT file:  Enumerate all instances of said file and validate which copy it might be - a TXT file that is kilobytes in size is likely not it.  Is the TXT file going to be in a folder that is in the %PATH% of the user's environment?  If so, you could dramatically limit your search scope by only searching for the file along the path.
0
 
LVL 10

Expert Comment

by:Duy Pham
ID: 41788241
I assume that each and every police department uses the same application to first open front-end txt file to get path to back-end access database file, then to open back-end database to work with. If that application used by police departments does have a logic to find the txt file no matter which client machine it is running on, then I think you might be able to use the same logic to find and read front-end txt file.

Another option could be possible if your front-end txt file is installed by an installer, and your front-end txt file path is relative to the installation folder, then you could try to lookup into Windows Installed Programs list and then find the installation folder.

Otherwise, if your front-end txt file is manually copied to client machine. I don't really see any option for you to accomplish and make a generic database updater application. The only option is that your new database updater application should ask for the path to front-end txt file when being executed on client-machine. And if your database updater application is going to be used a lot in the future, you can save the path to front-end txt file right away (to a fixed location or to registry) on the first time it is specified on each client machine and then just load it next time database updater application runs.
0
 
LVL 2

Expert Comment

by:Antonio Salva Ripoll
ID: 41788651
Hi.

In my opinion, you can locate all backend files on one serverand in the same folder (if possible), then you can access all backend files easily with your .net app.

To access the backend files from Access you can use the UNC path instead of using mapped drives. A UNC path is the form \\ServerName\ResourceName\Folder.

You can obtain the UNC path from the Mapped_Drive:\Folder by using the Scripting.FileSystemObject. It's very easy.

If you need help for using the FileSystemObject, please, feel free to ask.

Best regards.

Antonio.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question