Hello!

I'm making an enrollment application in vb6, using Access as my database. It will be used by 2 to 3 persons (registrar and cashier).

What codes do I need if I want to retrieve data from my database from one pc to where my database is?

If I declared a variable publicly in a module, will its values overlap if two people are using it at the same time in a network?

I don't know what to do. Can anybody please help me? If possible, can you please give me a sample?

Thank you very much.

Edited 6 Years Ago by fruitcake04: n/a

You simply need to store the database in a shared location to which all the PC running the application has access. You do not need to make any specific changes to your code to do any DB operations.

What codes do I need if I want to retrieve data from my database from one pc to where my database is?

You need to point your program connection to, as debasisdas said, to the database on the shared drive...

But how do you do this, you ask?

You are going to need to use either the registry (maybe you can still get away with using GetSettings/SaveSettings or perhaps you will need to use the API) or a setting file (INI) to store a couple pieces of information. The first piece of information is has the program been run before on this computer. If it has then retrieve the path to the database (your second piece of information you will need to store) and assemble your connection string. If not, prompt (maybe with common dialog) user for the path to the database, once recieved, save it, build your connection string and continue on.

Another way, if all machines have the same drive letter mapped to the same share where you database is, is to hard code this information and then you may not need the registry or the setting file.

What codes do I need if I want to retrieve data from my database from one pc to where my database is?

Search the web/this site for ADO tutorial and see http://www.connectionstrings.com

If I declared a variable publicly in a module, will its values overlap if two people are using it at the same time in a network?

No, the application, even if it is access itself, is run in/on the local machines memory, and as such, no two computers, at least in present day systems, use the same memory.

I don't know what to do. Can anybody please help me? If possible, can you please give me a sample?

There are plenty of samples on the web for your friends (yahoo, google, ask, answers, bing) to find. All you need are the correct keywords, like...
vb6 getsetting
vb6 savesetting
vb6 ini file
vb6 ADO Tutorial

Good Luck

hi,

assuming the pc's are networked
1. make a copy of your database (just in case).
2. split the database so that you have 2 databases
one with tables only and a different name
the other with table links (and queries,pages, forms etc if you had any)
3. place the database (with tables only) in the central pc (the one that will act as a server to be accessed by the others).
4. then in the users machine where the system is installed
-locate the installation folder
-open the database and delete all the tables (NB: tables only)
-use the link tables command from 'File-Get External Data' menu and browse to where the central database is placed (step 3) after link process the tables will have arrows to show they are linked)

you wont change any coding in your VB program and you are good to go.

i hope this will help

This article has been dead for over six months. Start a new discussion instead.