how can i run a select statment with vba and use the values it returns?

  • Thread starter Thread starter Zodiacal
  • Start date Start date
how can i run a select statment with vba and use the values it returns?

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.
 
Back
Top