1,105,331 Community Members

Connecting an access database in vb 6

Member Avatar
Jollyyy100
Junior Poster in Training
92 posts since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 

I want to connect my access database to my project in vb 6.

What are the steps i should follow?

Once i'm done with that, i want to know how to drag them and place them on a form (like the way we do it in VB.NET).

Thank you

Member Avatar
AndreRet
Industrious Poster
4,492 posts since Jan 2008
Reputation Points: 362 [?]
Q&As Helped to Solve: 499 [?]
Skill Endorsements: 24 [?]
 
0
 

You guys need to search a bit more please.:)

Have a look at This link that was discussed at the same time as your first post today.

The basics is all there.

Member Avatar
Jollyyy100
Junior Poster in Training
92 posts since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Gone through it, doesn't help.
But
Thank you

Member Avatar
AndreRet
Industrious Poster
4,492 posts since Jan 2008
Reputation Points: 362 [?]
Q&As Helped to Solve: 499 [?]
Skill Endorsements: 24 [?]
 
0
 

Then we are missing the question. What exactly do you need. I'm off now, will reply tomorrow morning.:)

Member Avatar
abelingaw
Posting Whiz in Training
247 posts since Jun 2008
Reputation Points: 69 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 2 [?]
 
0
 

What part are you trying to connect your database to?

Is it the project or a datagrid or listview?

If it is your project, the link sir Andre has given will show the basics.

Member Avatar
abu taher
Practically a Posting Shark
859 posts since Jul 2008
Reputation Points: 4 [?]
Q&As Helped to Solve: 78 [?]
Skill Endorsements: 0 [?]
 
0
 

search engine can help you. you get lot of answer of your question.

Member Avatar
Jollyyy100
Junior Poster in Training
92 posts since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Okay, i'm generally making a program which captures information about customers and payments.
To do so, i'm using vb6.
In order to store and retrieve this data i have made an access database.
Now i do not know how to connect that table created to my project.
But the major thing is that i do not want to use the ADO and stuff, i want to use a connection string.
So i wanted to ask, how do you do that. Are there a set of codes required for a connection string?
Do i have to make an interface with a label (firstname,lastname) and textboxes ....
And after we do that, how can we make sure it is saving in access.

Hope my question is clear enough now, i have tried my best.
Thank you

Member Avatar
AndreRet
Industrious Poster
4,492 posts since Jan 2008
Reputation Points: 362 [?]
Q&As Helped to Solve: 499 [?]
Skill Endorsements: 24 [?]
 
0
 

ADO is active data objects, making use of connection strings etc. So, that said, have a look at the link I gave above. The code discussed there as well as the references needed is all in there.

Member Avatar
Jollyyy100
Junior Poster in Training
92 posts since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Ok...
Thank you

Member Avatar
abelingaw
Posting Whiz in Training
247 posts since Jun 2008
Reputation Points: 69 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 2 [?]
 
0
 

I think your missing the connection part.

Here:

'Put this in General Declaration area

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset

Then have this where you want to create the connection

Set db = New ADODB.Connection
        db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database.mdb"
    
'Change Database to your database name

Set rs = New ADODB.Recordset
        rs.Open "Select DATABASETABLENAME from TABLEFIELD", db, adOpenStatic, adLockOptimistic

'DATABASETABLENAME is the table from your database
'TABLEFIELD is where you records be found

Or you can just do your connection by creating a module.

Public DBLink As New ADODB.Connection
Public RecSet As New ADODB.Recordset

Public Sub Con(Database As String)

DBLink.Provider = "Microsoft Jet 4.0 OLE DB Provider"
DBLink.ConnectionString = "Data Source=" & App.Path & "\" & Database
DBLink.Open

'Still the Database is the database name - rename it  to your own

End Sub

Then just call the connection on where you need it.

E.g in a form:

Call Con
Member Avatar
Jollyyy100
Junior Poster in Training
92 posts since Jul 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I'll try it out...

Thank you

Member Avatar
AndreRet
Industrious Poster
4,492 posts since Jan 2008
Reputation Points: 362 [?]
Q&As Helped to Solve: 499 [?]
Skill Endorsements: 24 [?]
 
0
 

It's a pleasure.:) If it helped solving your problem, please mark this as solved, thanks.:)

Question Answered as of 3 Years Ago by AndreRet, abelingaw and abu taher
jazz00030
Newbie Poster
1 post since Feb 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
-1
 

pls

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: