troubleshooting Question

Recordset not working

Avatar of SweetingA
SweetingA asked on
Microsoft Access
10 Comments1 Solution356 ViewsLast Modified:
Hello Experts,

The following recordset code is not working corrrectly.

The first record is copied multiple times instead of stepping through the records.

Can you help?

Dim rst As DAO.Recordset
    Set rst = CurrentDb.OpenRecordset("SELECT * FROM qry_PDM_Questions WHERE " & Me.Filter)
    rst.MoveFirst
   
    Dim rstADD As DAO.Recordset
    Set rstADD = CurrentDb.OpenRecordset("tbl_PDM_Results")

    Do Until rst.EOF
        strSaveCriteria = Me.txtPeriod & Me.txtSite & Me.txtFunction & Me.txtCell & Me.Question
        rstADD.AddNew
        rstADD("Period") = Me.txtPeriod
        rstADD("Site") = Me.txtSite
        rstADD("Function") = Me.txtFunction
        rstADD("Cell") = Me.txtCell
        rstADD("Question") = Me.Question
        rstADD("Answer") = Me.Answer
        rstADD("SaveCriteria") = strSaveCriteria
        rstADD.Update
        rst.MoveNext
    Loop

    rst.Close
    rstADD.Close

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros