Access Vb Code For Calling Queries Guide

This method is "silent" and won't trigger the "You are about to append X rows" pop-ups. 3. Passing Parameters to a Query

Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("qryActiveUsers") Do While Not rs.EOF Debug.Print rs!UserName ' Print the value of the "UserName" field rs.MoveNext Loop rs.Close Use code with caution. Copied to clipboard Pro-Tip: Avoid DoCmd.RunSQL Access Vb Code For Calling Queries

Dim db As DAO.Database Set db = CurrentDb ' Runs "qryUpdatePrices" and stops if there is an error db.Execute "qryUpdatePrices", dbFailOnError ' Check how many rows were changed MsgBox db.RecordsAffected & " records updated." Use code with caution. Copied to clipboard This method is "silent" and won't trigger the