Use dbFailOnError to ensure the code stops if the query fails (e.g., due to a validation rule).
To run an , Append , or Delete query without showing anything to the user, use the .Execute method. This is the "professional" way to handle data. Access Vb Code For Calling Queries
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 Use dbFailOnError to ensure the code stops if