How to run mdb database with lan and vb6?

Asked By 0 points N/A Posted on -
qa-featured

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.

George Ppercy

SHARE
Answered By 10 points N/A #170183

How to run mdb database with lan and vb6?

qa-featured

Hi George,

Networking with Access database is possible and easy by just using or configuring you Connection String.

Example:

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.

Err:

If err.description = "" then

Else

mgsbox err.description

End if

Or

On error resume next.

Thanks.

Login/Register to Answer

Related Questions