Dim Rst As Recordset
Dim tmpDb As Database
Set tmpDb = CurrentDb
Set Rst = tmpDb.OpenRecordset("select * from PassWord where user='" & UserName & "';")
試試這樣子
Dim Rst As DAO.Recordset
Dim tmpDb As DAO.Database
Set tmpDb = CurrentDb
Set Rst = tmpDb.OpenRecordset("select * from PassWord where user='" & UserName & "';")