Now, on this article i will share about Create Microsoft Access Database Connection Visual Basic 6. In here i will use Microsoft access 2007 and Microsoft visual basic 6, where the both programs are programs that are owned by Microsoft. Microsoft Access 2007 is a database application computer used to design, create and process a variety of data types that have a relationship with each other. While Microsoft Visual Basic is a programming language that works within the scope of Microsoft Windows which Microsoft Visual Basic 6 can advantage of the sophistication that is be possessed by the Windows Operating System.
This is The steps we have to do for Create Microsoft Access Database Connection Visual Basic 6 :
- Create a database and tables in Microsoft Access 2007
- Open Microsoft Access 2007 Program, then click New Blank Database
- Then click and change Save as Type to Microsoft Office Access (2002-2003) so database extension change to mdb because this extension already popular with me. If you want to use Microsoft Office Access 2007 Databases then database extension are accdb just different database extension.
- Change database named and location want to save the database for this time i saved to C:\Latihan\dbLatihan.mdb
- And then click the button Create so the database that we had created already to used Create Microsoft Access Database Connection Visual Basic 6. But there are no table in database, we just create connection to that database.
- Create connection in Microsoft Visual Basic 6
- Open Microsoft Visual Basic 6 Program from the Start Menu then All Programs click Microsoft Visual basic as this picture below :
- On window New Project Choose Standard Exe then click button Open
- After do the steps above, now we haved project1 and form1. For Create Microsoft Access Database Connection Visual Basic 6 so we need a module connection. Module usually used to contain procedure or function or variable which is general can used in other form on the project environment. For adding module view picture below :
- After that will be appear Add Module Window and press button Open and on project Window we have Modules folder and Module1 that was added.
- After adding module now we will be add codding for Create Microsoft Access Database Connection Visual Basic 6. Double click on Module1 and adding this code into Module1 :
Public CONN As New ADODB.Connection Public LokasiDB As String Public Sub BukaKoneksi() If CONN.State = 1 Then CONN.Close ' jika koneksi masih terbuka makan akan ditutup LokasiDB = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=&quot; &amp;amp; App.Path &amp;amp; &quot;\dbLatihan.mdb&quot; CONN.Open LokasiDB End Sub
If ADODB do not appear so library is not active so that we can not Create Microsoft Access Database Connection Visual Basic 6
- After succeed create connection so we will call Sub Connection that was create with using command Call<space>Name Sub Connection. For example Call BukaKoneksi, that is sub connection above. We can call that Sub Connection on project environment in form.