Getting the next record (VBA)

R

Rodolfo Fontes

Hi group,

How can I get the next value of a querie?
For example, I can use "temp = rs_NFS!DT_Emissao" to get the DT_Emissao from
the current record, but i want just to get the next value, not "walk" on it.
Below an example:

Dim db_NFS As Database, rs_NFS As Recordset
Set db_NFS = CurrentDb
Set rs_NFS = dbs_produto.OpenRecordset("SELECT [T NF_S].DT_Emissao, [T
NF_S_Det].CodProd, [T NF_S_Det].Qtd_NF, [T NF_S_Det].Valor_NF " _
& " FROM [T NF_S] INNER JOIN [T NF_S_Det] ON [T NF_S].Cod_NF_S = [T
NF_S_Det].Cod_NF_S " _
& " WHERE ((([T NF_S].DT_Emissao) Is Not Null) And (([T
NF_S].Processada) = -1) And (([T NF_S].Cancelada) = 0)) " _
& " ORDER BY [T NF_S].DT_Emissao, [T NF_S_Det].CodProd;")

Thanks,
Rodolfo Fontes
 
D

David Seeto via AccessMonster.com

Hi Rodolfo,

Not sure what you mean by "walk", but to get to the next record in a
Recordset, it's simply rs_NFS.MoveNext. The fields will then correspond to
the values in the next record retrieved by the query (unless, of course,
there aren't any more, in which case you won't be able to refer to the
fields and the condition rs_NFS.EOF will be True instead of False)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

access is rounding a value 9
Sintax error 1
Random Top 10 percent of groups 6
form criteria 4
order on the months 3
order on the months. 4
Access Form Next Record button / move next 1
I´m getting nutts here! 1

Top