J John Vinson Sep 19, 2003 #2 how can i run a select statment with vba and use the values it returns? Click to expand... Open a Recordset: it can be done in either ADO or DAO. I'm more familiar with the latter: Dim rs As DAO.Recordset Dim db As DAO.Database Set db = CurrentDb Set rs = db.OpenRecordset("SELECT ...") rs.MoveFirst You now have a Recordset with all the fields; their values can be ascertained using expressions like strX = rs!TextField lngJ = rs!NumberField and so on.
how can i run a select statment with vba and use the values it returns? Click to expand... Open a Recordset: it can be done in either ADO or DAO. I'm more familiar with the latter: Dim rs As DAO.Recordset Dim db As DAO.Database Set db = CurrentDb Set rs = db.OpenRecordset("SELECT ...") rs.MoveFirst You now have a Recordset with all the fields; their values can be ascertained using expressions like strX = rs!TextField lngJ = rs!NumberField and so on.