poonjabba,
Below is a Database Connection example that I've used with Access 2000:
Code:
Public Sub CompleteDatabaseExample()
Dim dbMain as New ADODB.Connection ' Declaring the Connection
Dim rsCustomer as New ADODB.Recordset ' Declaring the Recordset
Dim SQL as String ' Declaring a simple variable
dbMain.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ ' Connecting to the Database
"Persist Security Info=False;" & _
"Data Source=C:\WINDOWS\Desktop\training.mdb"
SQL = "SELECT * FROM Customer" ' Setting up our SQL Command statement
rsCustomer.Open SQL, dbMain, adOpenDynamic, adLockOptimistic ' Opening the Recordset (see Recordset Options)
Do While Not rsCustomer.EOF ' Loop until we reach the End-Of-File marker
MsgBox "The Customer's Name is: " & rsCustomer("Name")
MsgBox "The Customer's City is: " & rsCustomer("City")
rsCustomer("Country") = "United States"
rsCustomer("Name") = rsCustomer("Name") & " Jr."
rsCustomer.Update ' Updating the Records (see also Recordset (Working With))
rsCustomer.MoveNext ' Moving to the next record (necessary to reach the EOF)
Loop
rsCustomer.Close ' Closing the recordset
dbMain.Close ' Closing the database connection
End Sub
CarlR