Can anybody help me in on how to connect my VB interface to a database.
I have already designed the interface but I do not know how to connect it to Dbase.

Damson

This following code to connect vb 6 with access
place this code in module :

Global Conn As ADODB.Connection
Global rs As ADODB.Recordset

Sub Access_Connector()
    Set Conn = New ADODB.Connection
        Conn.Provider = "microsoft.jet.oledb.4.0"
        Conn.CursorLocation = adUseClient
        Conn.Open App.Path & "\SIS.mdb"
End Sub

Thanks. I mean to connect to microsoft access and creation of the table .

you want to connect to anexisting database or create a new one at run time ?

Can u do the right Syntex
.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= &" \ App.Path \ "Xyz.mdb"

Can u do the right Syntex
.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= &" \ App.Path \ "Xyz.mdb"[/Q

.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Xyz.mdb"

Good Luck

Can anybody help me in on how to connect my VB interface to a database.
I have already designed the interface but I do not know how to connect it to Dbase.

Damson

try the following

'in VB i set references to - Microsoft ActiveX Data Objects 2.5
'declare the following variables in a module 

Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset

'create the following function in the module so that the 'connnect' 'function 'can be accessible throughout the project

Public Sub connect()

With cn
  .Provider = "microsoft.jet.oledb.4.0" 
  .ConnectionString = App.Path & "\subscriptiondb.mdb"
  .Open
End With

End Sub

on the form load of every form call connect function to initialize it and that will be your active connection

NB: use 3.51 for lower versions of ms office (<2000) and 4.0 for higher versions(>=2000)

Can anybody help me in on how to connect my VB interface to a database.
I have already designed the interface but I do not know how to connect it to Dbase.

Damson

Hi

Dim cn As ADODB.Connection
Dim DataFile As String

DataFile = "C:\Database\my_database.mdb"
   Set cn = New ADODB.Connection
   cn.CursorLocation = adUseClient
   cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataFile & ";"

This will help you connect to the database
Happy Programming

CodeFixer and ankush,

What are you doing replying to an old thread??? Don't you know that resurrecting the dead around here will get you labeled a necrophiliac. (Look it up over at dictionary.com to know just how bad of a label it is) :)

Please stop this practice...

Hi vb5prgrmr
I am really sorry
I did not see the date
I will keep your word in mind in the future.

kindly help me that how i can connect ms access2007 multiple forms in vb 6.0..

Kojhani, seeing that you are a new poster, we'll let this one slip. In future, please open your OWN thread. This thread is very old, not every one will open it, which means less people will give you a solution.

To your question, follow the next link, select access and copy the connection string.
http://www.connectionstrings.com

i have to connect access to Vb 6.0 and
i am able to connect it but after connection when i enter record source-2-addcmdtable it will ask for stored table or procedure name..
and when i scroll that their will be no name to which table i can conect to.....
i dont knw what is this...........
plz help me........ :-(

i have to connect access to Vb 6.0 and
i am able to connect it but after connection when i enter record source-2-addcmdtable it will ask for stored table or procedure name..
and when i scroll that their will be no name to which table i can conect to.....
i dont knw what is this...........
plz help me........ :-(

Nikianand, I will refuse to answer your question in this post. Open your own thread/post and I will gladly give you a solution. This post belongs to someone else.:)

'in VB i set references to - Microsoft DAO 3.6 object library
Dim dbdata as database
Dim recinfo as recordset

private sub form_load ()

Set dbdata = Opendatabase (App.path & "\mydatabase.mdb")
Set recinfo = dbdata.OpenRecordset("mytable")
recinfo.index"ID NO"
end sub

Gihan, NOBODY will answer your question whilst it is posted here. There is 5 posts above this stating clearly that you have to post your own thread.

Please open a new thread and we will gladly help.:)

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.