How do I get the result of a Select SQL statement in VBA -
i want able use sql retrieve data table , display immediate window in access.
i new vba , can't seem find way of doing it
dim strsql string dim cdb dao.database dim result variant strsql = "select x, y z;" set cdb = currentdb debug.print strsql result = call cdb.execute(strsql) debug.print result
to print value of field first record.
dim strsql string dim result dao.recordset strsql = "select x y z;" set result = currentdb.openrecordset(strsql, dbopendynaset) result.movelast result.movefirst debug.print result!x
if want print value each record, use loop structure move each record like:
do while not result.eof debug.print result!x result.movenext loop
review site http://allenbrowne.com/tips.html - @ section 'examples library' halfway down.
Comments
Post a Comment