简体   繁体   中英

How to moveNext in DAO record set in MS Access form

Below is my code for DAO recordset.

Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("getOrderRecords")
Set orderRST= qdf.OpenRecordset
Debug.Print "DAO Records"

txtRequestID = orderRST.Fields("OrderId")

Similar to txtRequestID , I have so many fields, which I plan to populate using DAO due to some design reasons.

The problem is, the first recordset object will come on FormLoad, but the second is not coming up if I moveNext in the navigate button. How can I code for the navigation. Someone pls help.

The navigateButton of the form is connected to the Recordsource of the form. If you create a separate variable with a recordset in it, it isn't connected to the form and thus the form navigation doesn't work. Either set Me.Recordsource="getOrderRecords" or create a button and in the OnClick event set the move next: orderRST.moveNext .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM