Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB and Networks

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
0
0
AU
Hello,

I have developed a VB6 application which uses Access2000, it was originally designed for use on a single terminal only. The application was coded so that on installlation it creates a directory on the hard drive (C drive) where it places the Access database, which is to be read by the VB6 application. I had a client make an urgent request to have the program networked between two terminals. I wish to do everything humanly possible to avoid changing every single statement in my program which points to the C drive (so that it looks at their network drive), aside from that, I also have around 70 crystal reports (Version 4) that will need to be re-done. There is an enourmous amount of work to be done if I cannot find a simpler solution.

Is it possible to have the second terminal using the first terminal's hard drive and also recognising that directory as C (the first terminal can act as a server)????? If so, how can it be done?? OR is there a better solution.

Thank You

[sig][/sig]
 
Book 1 Page 1, Rule 1:
You need to smarter than the equipment you are working with.

Book 1, Page 1 Rule 2:
Failing Rule 1, Read the (equipment) manuals

Book 1, Page1, Rule 3:
Failing Rule 2, refer to rule 1

End Of the Rules

e.g. [red]NEVER[/red] hard code that which can be set via reference.

Start NOW to build either an ini file or registry entries to set up you app so that it is as independent of user vageries as possible. All databases which are useful ultimatly need to be multiuser constructions, so you have started down the 'primporse path' to self destruction with the best of intentions by setting the db path in hard code. Another issue for you is the legal licensing - especially for the Crystal reports. While this is "a lot" of work, in the long run you may be better off for the experience.

Look closely at the "terms of servitude" for your app. If your 'Client' originally specified a single user app, or failed to specifically note/mention/require a multi-user app, you may be able to get him to fot the entier bill for the conversion - Paying you for the 'learning' experience!!!

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
The simple solution is to use linked tables in the database, and then have a 'Locate Database' option on the menu. On selecting another database, relink the tables in the database to the selected database. That way you can continue hardcoding the database path (as much as it grieves me to write that) in your application.

The normal way I do it is to have the database installed in the application path, and then have the locate database option as mentioned. That way, you don't need to hard code the database path - it is App.Path & &quot;\data.mdb&quot; - and the database links will point to the 'real' database.

E mail me at swilliams@paragon.bm if you want further information.

Simon [sig][/sig]
 
SIMON - shame on you!!! DONT encourage this - it can only lead to a bad end!!!!
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
True enough MichaelRed, but if all 'Mans' wants is a quick fix to the networking issue then the linked table method is the way to go, I think.

I do agree with you though, that the program should be rewritten using an ini file, but even if this is done, I would still recommend using linked tables in the database.

Simon [sig][/sig]
 
You could set up a &quot;Share&quot; in Windows Explorer so that the directory with the the .mdb file is visible from the other workstation.

It *does* mean that you will need to change all of the references to the path and filename in your vb6 app to something read from a confguration thing -- I suggest you check out GetSetting for an easy way to retrieve config data for a VB app.

Simons solution is the quickest though.... What he doesn't mention is that you will have to set up a &quot;Share&quot; in Windows Explorer so that the dir is visible from the other machine.

[sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Whatever you will do, but do u care about locking in the system and the biggest problem is your reports. Are they location independent. or map the local &quot;C&quot; drive of other terminal with the network drive. When your application starts, it will ignore your drive and treat other drive as C. But remember to change it back when exit from application. This solution only applicable if your user not running anything at the same time.
 
Mans,

If the loaction of your database is hardcoded you can do a search replace in VB.

rgds,

Leaf [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top