I made a vb project and there i use a database as "super.mdb".My database is located at mydocuments. So i used the path(c:\mydocuments\super.mdb)in forms of my project to connect the database with my vb project. After making my project as a setup file, I installed it in my system and it works perfectly. But when i installed it on another system, It says that "can't able to find my database".when I made setup file,I added super.mdb file to package folder.how can I make setup file working properly in another computer.

This is a common mistake when writing a new application.

When you start a new project, create your database in the folder that you have created for the application...

You should then use the path to the database to make sure it works 100%.

path(c:\mydocuments\super.mdb) is incorrect, use the following...

rsMyRecordset.Open (App.Path & "super.mdb"

App.path will refer back to where the application was installed and will then make the call the database.

Im sorry I don't undestand how to use above code.I will further explain you about my project.lets think that database is located at "F:\project\" .In my database (stock.mdb) there is a table name as "products".my project has two forms namely form1 and form2. at form1 I use below codes

Dim db As Database
Dim tbpro As Recordset

Private Sub cmdadd_Click()
tbpro.AddNew
tbpro!proid = txtid.Text
tbpro!prodesc = txtdesc.Text
tbpro.Update
txtid.Text = ""
txtdesc.Text = ""
txtid.SetFocus
End Sub

Private Sub Form_Load()
Set db = OpenDatabase("F:\project\super.mdb")
set tbpro = db.OpenRecordset("products")
endsub

please tell me how can I use the code you given above

rsMyRecordset.Open (App.Path & "super.mdb"

in form1.please help.

I got the solution.The code you given above should recorrect as

rsMyRecordset.Open (App.Path & "\" & "super.mdb")

then it works well.thank you very much for helping me.thanks bravo..

Sorry now I have another problem.In my project I used a datagrid and Adodc.datasource of datagrid is Adodc.there in Adodc properties I select "use connection string".I used Microsoft jet 4.0 OLE DB provider and select the connection path to the database as "F:\project\super.mdb".I made the setup file as mension above and install it.when Im runing the program the datagrid is not work.it says the path "F:\project\super.mdb" is invalid.how can I solve this problem.help me please.

It was apleasure. Please mark this as solved, thanx. :)

ok..Sorry now I have another problem.In my project I used a datagrid and Adodc.datasource of datagrid is Adodc.there in Adodc properties I select "use connection string".I used Microsoft jet 4.0 OLE DB provider and select the connection path to the database as "F:\project\super.mdb".I made the setup file as mension above and install it.when Im runing the program the datagrid is not work.it says the path "F:\project\super.mdb" is invalid.how can I solve this problem.help me please.

Set your connection the same as your recordset. The database should be in app folder as well -

Set db = OpenDatabase(App.Path $ "\super.mdb")

No.Im asking how can I set connection string path to adodc.

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\project\super.mdb

the path sould be valid when runing the program in another computer too.

In that case you need to open a new thread with your question "Connect datagrid to database". This question has been answered, please mark as solved, thanx.

I'll answer on your new thread.

oh I see.sorry for that.ok I will start new one.:)

No problem :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.