Re: Delete Record from table
That command will delete ALL of the records where the where clause is meet. I guess I don't understand why you would need a loop? If there more detail to this problem?
As for your side note, if they both are linked to the same table, you won't have an problem. You will, however, have a problem with asyncronization between the different forms. If one form is open and the other form deletes; the first form won't reflect the changes until it's requeried (this is a whole new beast to deal with).
Ohh, and the syntax is:
DoCmd.RunSQL strSQL
Re: Delete Record from table
lilmark,
I don't think the syntax on the SQL string is correct.
VB Code:
strSQL = "DELETE * FROM tblAcct WHERE [date] = #1/1/06#"
DoCmd.RunSQL strSQL
I use Access 2003 and I would need the * after DELETE for it to work. Also, if date field is a string, then you had the last part right, but probably it is a Date datatype, so I put # symbols around it in stead of single quotes.
Hope this helps.
-Ranthalion
Re: Delete Record from table
Oh ok. I thought I had to loop it through each record one by one and delete them. I don't use SQL a lot and have never used it to delete so it's still new to me. I guess I'm just used to using loops to go through all the records to search for a specific record with VB 6.0.
This program is simple. It is just a SINGLE form that the user will use to input data. They will not be able to view any other data. This SQL delete is just to be run when the user opens the program so it will delete any record that is a month old. So, I don't think I'll have any problems unless there's something else you can think of.
Ya, sorry, forgot to add the strSQL to end of that command.