I have a deleting query that deletes all empty record when you open the form. But I don't want to it to prompt the user to execute. I want it to automatically run, how can i do that?
Use Code instead. Put this code in your On_Load event of your form.<br>-----------------------------------<br>Private Sub Form_Load()<br> ' This routine opens a table and moves to the last record<br> ' gets the records count then deletes each record<br> '<br> Dim db As Database, rst As Recordset, x As Integer<br> Set db = CurrentDb<br> Set rst = db.OpenRecordset("Test"<br> rst.MoveLast<br> For x = rst.RecordCount To 1 Step -1<br> rst.Delete<br> rst.MovePrevious<br> Next<br> rst.Close<br> db.Close<br>End Sub<br>---------------------------------<br>OK<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
<br><br>DoCmd.SetWarnings(off)<br>DoCmd.runSQL "DELETE FROM Table1 where field1 is null"<br>DoCmd.SetWarnings(on)<br><br>I use very litle 'DoCmd dot' stuff so check the syntax<br>on 'SetWarnings = Off' / 'SetWarnings(off)'.<br><br><br>..and have fun !<br><br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.