Results 1 to 6 of 6

Thread: How to connect the VB6 with MS Access 2003?

  1. #1
    Join Date
    Dec 2009

    How to connect the VB6 with MS Access 2003?

    I am beginner in the programming language world(i.e beginner programmer). I am learning language: Core Java, Visual Basic, SQL, ASP and C sharp. In this days, i am doing project in Visual Basic 6 and this project has backend as MS Access. When i was trying to connect both i.e VB6 and MS Access 2003, i got error when i tried to connect between "record source" in VB6 with data that is saved Access. Please tell me how to connect the VB6 project with MS Access 2003.

  2. #2
    Join Date
    Jan 2008

    Re: How to connect the VB6 with MS Access 2003?

    As per my knowledge the Visual Basic 6 is only able to manage the MS Access 97 file formats. So, before connecting the MS Access 2003 file to the VB 6, convert the that Access 2003 file to the Access 97 format, because it supports only the Access 97 files. This converting can be done easily, Goto MS Access 2003-- Open your database file--Tools--Database Utilities--Convert Database --To Access 97 file Format. Once this is done you will not able to do any modification in your file so, take this after completing the modification or create a new access 97 file every time you make changes.

  3. #3
    Join Date
    Feb 2008

    Re: How to connect the VB6 with MS Access 2003?

    To connect Visual Basic 6 to the Ms Access 2003 file, you need to use the DAO or ADO as connection provider to the database. For this, inside Menu, put a click on Microsoft ActiveX Data Objects.
    And in your project General Declaration Area, have to write this code:
    Dim con As New ADODB.Connection
    Dim r1 As New ADODB.Recordset
    And in Form's Activate Event
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="your database complete path";Persist Security Info=False"
    r1.Open " select * from (your database name)", con, adOpenStatic, adLockPessimistic
    Hope you will able to understand this code, and can apply in your project.

  4. #4
    Join Date
    May 2008

    Re: How to connect the VB6 with MS Access 2003?

    I would prefer to use the ADO(ActiveX Data Object) to connect VB6 to MS Access file. The ADO is the most basic and simple way to connect to the database. Basic of the connection is as follow:
    Dim con As ADODB.Connection, recsource As ADODB.Recordset
    Dim strCon as String, str1Sql as String
    Set con = New ADODB.Connection
    Set recsource = New ADODB.Recordset
    strCon = "Provider=Microsoft.Jet.OLEDB.4.0;"& "Persist Security Info=False;"&"Data Source=\\Server\Share\DatabaseName.MDB"
    con.Open strCon
    str1Sql = "SELECT * FROM Tablename "
    recsource.Open str1Sql, con, adOpenKeyset, adLockOptimistic
    Hope this code will make you understand how to connect MS Access.

  5. #5
    Join Date
    Oct 2005

    Re: How to connect the VB6 with MS Access 2003?

    I know one of the step to connect the Visual Basic to the MS Access2003, and it goes like this:Goto "Control Panel"--Click on "Performances and Maintenance"--Click on the Administrative tools option--DoubleClick on Data Sources (ODBC)--Note that you watch a dialog box--in that Click System dsn--After that Click on add-- Again DoubleClick Access2003 driver .mdb--Click Select then find the Access2003 database which you saved--then click on OK--In the Data Source Name option type the filename of the Ms Access Database( like db1.mdb)--Click OK. Press enter. Hope this method will allow to use the MS Access2003 files in Visual Basic 6.

  6. #6
    Join Date
    May 2008

    Re: How to connect the VB6 with MS Access 2003?

    According to me you should use either the ADO(ActiveX Data Object) or DAO(Data Access Object). This are the basic and most simple method used to connect VB 6 to the MS Access. The basic code for ADO is as follow:
    In general declaration
    Dim con as Adodb.connection, rs as Adodb.recordset
    Dim sql1 as String, sql2 as String

    Private Function Connection()
    Set rs = New ADODB.Recordset
    Set con = New ADODB.Connection
    sql1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Fullpath of database" & ";Persist Security Info=False"
    con.Open (sql1), , , 0
    End Function
    Call this Connection in which ever form you want the database connection.
    Hope you will get solve soon and your project gets complete on time.

Similar Threads

  1. XP VPN to SBS 2003 will not connect
    By lbischoff in forum Small Business Server
    Replies: 3
    Last Post: 05-11-2011, 03:09 AM
  2. Read Access 2003 files with Access 2007
    By Kendal-J in forum Windows Software
    Replies: 2
    Last Post: 26-05-2010, 05:57 PM
  3. Connect Windows 7 to SBS 2003
    By Galiher in forum Small Business Server
    Replies: 2
    Last Post: 30-04-2010, 06:17 PM
  4. Remote Access and Outlook Web Access on SBS 2003
    By mannuraama in forum Small Business Server
    Replies: 4
    Last Post: 04-06-2008, 04:22 AM
  5. ACCESS 2003 TRIAL
    By Suu!Shant in forum MS Office Support
    Replies: 1
    Last Post: 31-05-2007, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts