Update/Delete Query

artofescape

New member
Local time
Today, 03:23
Joined
Mar 22, 2006
Messages
9
This stuff can sure be stressful. :)
Anyway!
This is all linked to a form, but it's queries I'm sure I'm having the problem with. I'm hoping someone can help me out here.

I have fields in a subform which I've got an update query running after the focus is lost on a field, and it puts these values in a table I created. I'll call this table A. This is so that I may run another update query on the form when this is done, and have it take the values from this table created and add them to a total in another. I'll call this second table B.

I know this design behind this is flawed because in theory I don't need the 'temporary store' (A), but it's in the design of the thing to show that the values are infact being stored. As I'm sure you can understand, in order to keep doing this each time I open the form, I need to clear A. Preferably on a button press on the same form so that I may have the totals all calculated on B and then clear A right after.

The problem I'm having is that I'm using a delete query on a button press, and instead of just clearing the fields I need it to, it's deleting everything in A. I should mention that in A I have an ID field which should be telling the update/delete query which records to update/delete from in the criteria. This is a problem because it's deleting all the records on the form as I have them linked to A.

Any suggestions?
Thanks.
 
OK, if I understand correctly, you basically want to clear certain fields on records in table A instead of deleting rows.
If so use an UPDATE statement set the value of the fields you want to clear to NULL or "" or 0 (depending) instead of r deleting them.
 
That was exactly it, worked like a charm. Update instead of delete was perfect because it doesn't get rid of the rows. No idea why that didn't occur to me seeing as I was using update queries alongside the delete too.
Thank you very much. :)
 

Users who are viewing this thread

Back
Top Bottom