N/APosted on - 03/04/2013
Hello TechyV Expert Community!
I have a problem about databases. I need to know what code I need to know and use to run my program (VB6) with database access on 2 or 5 Computer through LAN.
But when I run my program on another computer the error comes out. So here is my question, is there a way to solve this problem?
How can I run properly mdb database with LAN and VB6 Connected? Any comments and solution would be nice.
Thank you and have a good day.
How to run mdb database with lan and vb6?
Networking with Access database is possible and easy by just using or configuring you Connection String.
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:Program FilesMicrosoft Visual StudioVB98Database EditorDBEditor.mdb"
All you have to do is change the path, just locate the database on the network. Like this: Your computer is located at the server which has the IP address of 192.168.0.1 and in my documents folder or "192.168.0.1My DocumentsDatabase.mdb".
Your connection string goes like this:
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = 192.168.0.1My DocumentsDatabase.mdb"
Or you can use the name of the computer.
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = \ServerMy DocumentsDatabase.mdb".
But if the error goes like this "Database is in use" or "Database lock for computer 1" when editing, adding, deleting and updating records at the same table at the same time then it is normal because Access Database automatically locks the database if one have edited, add, delete or update records in it. If that is your problem just capture the error in your vb6 code. Like this:
On Error Goto err:
Your code goes here.
If err.description = "" then
On error resume next.