Dim strConn As String Dim Rs As New ADODB.Recordset strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "\Hotre12.mdb;Persist Security Info=False;Jet OLEDB:database Password='111222';" Rs.Open "Select * from msyscpb", strConn, adOpenKeyset, adLockOptimistic MsgBox Rs.RecordCount Set Rs = Nothing