Sub GatherDBData()
Set dbconn = Workbooks.OpenDatabase("c:\Test.accdb")
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=c:\Test.accdb;Persist Security Info=False;Jet OLEDB:Database Password="
Set rs = New ADODB.Recordset
rs.Open "Select * from [users]", cn
While Not rs.EOF
fname = rs.Fields("Fname")
lname = rs.Fields("Lname")
rs.MoveNext
Wend
End Sub
|