CODES FOR MODULE1
========================================================================
Option Explicit
Public con As ADODB.connection
Public ado As ADODB.Recordset
________________________________________________________________
Public Sub connection()
Set con = New ADODB.connection
con.CursorLocation = adUseClient
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database1.mdb"
con.Open
End Sub
=================================================================
CODES FOR FORM1
Option Explicit
________________________________________________________________
Private Sub Form_Load()
Module1.connection
On Error Resume Next
Set ado = New ADODB.Recordset
ado.Open "Select * From Table1", con, adOpenStatic, adLockPessimistic
Set DataGrid1.DataSource = ado
End Sub
=================================================================
CLICK HERE TO DOWNLOAD THE SOURCE CODE
No comments:
Post a Comment