What is the best way to read database records into Access VB?

  • Thread starter Thread starter Jim Arnold
  • Start date Start date
J

Jim Arnold

I have an Access VB based parameter SQL query that I want
to read parameters into from a table of parameters. What
is the best way to read the parameters into the VB code.
(i.e. read one row of parameters, run first iteration of
query which dumps result to a results table... then read
the second row of parameters and run the query again,
etc). I have a working query, I just need to figure out
how to read in my parameters.

All suggestions are welcomed.

Thanks,

Jim Arnold
 
-----Original Message-----


Opening a recordset is the common everyday way to read data
from a table using code. Assuming you're using DAO, the
code is like this:

Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset(paramtable) ' or a query
Do Until rs.EOF
' work with a record's fields
rs.MoveNext
Loop
rs.Close : Set rs = Nothing
Set db = Nothing

Marsh and others who may have tuned in... I followed the
suggestion above and it worked great. I also happened to
find the Access 97 Help File "RecordCount" property which
referred to an AbsolutePosition Property example very
similar to the suggestion above and with an embellishment
or two. This doesn't seem to be in Access 2000 for some
reason. In any event, it all worked great and I again
thank you for the help.
 
Back
Top