================================= Module ================================= Public db As ADODB.Connection Public rs As New ADODB.Recordset ------------------------------------------------------- Public Function dbDir() As String If Right$(App.Path, 1) = "/" Then dbDir = App.Path Else dbDir = App.Path & "/" End If End Function ------------------------------------------------------- Sub dbconnect() Set db= New ADODB.Connection db.Open "Provider=Microsoft.Jet.Oledb.4.0; data source =" & dbDir & "\Database\db.mdb; Persist Security Info=False;Jet OLEDB:Database Password=1234" Set rs= New ADODB.Recordset rs.Open "Select * from Table1", db, adOpenStatic, adLockOptimistic End Sub ------------------------------------------------------- Note: \Database\--->name of folder where the database is save. \db.mdb ----->name of the database(Access) Persist Security Info=False;Jet OLEDB:Database Password=1234" --->you can use this if your database has a password --->assuming that the password of the data basebase is "1234" db.Open "Provider=Microsoft.Jet.Oledb.4.0; data source =" & dbDir & "\Database\db.mdb" --->use this if your database has no password. *Then you can call function in every form load event. Ex. Private Sub Form_Load() Call dbconnect End Sub *You can check if the connection is correct by running the program. *That's it...so...as you observed,you can saved more space in coding. *Any questions, you can send me an e-mail .. lee.mark_mrdobledos@yahoo.com.ph *I hope it helps you a lot.. *Thnx for downloading, don't forget to subscribe and vote! *It's me...mrdobLedos ^__^