clear out the data in a table

Sri99

Registered User.
Local time
Today, 23:52
Joined
Nov 29, 2012
Messages
25
Hi
I have a form with sub form contains 9 Append queries. I have set them to be run automatically when the form closes by closing event with macros. now I have to set up as before query runs the target table should update with new data by clear out the old data every time when query runs. I have created Append query and queries are run from Append query and I don't want create Make-Table. The message should pop up as "The existing table XXXXX will be deleted before you run the query"
Can any one help me to fix this issue?

ThanQ
 
Hi
I never try and I don't know how the query will works? and I hope it will delete all the records if we use it, but the records wont be delete just clear out and new data should be exist?

ThankQ
Can you use Delete query?
 
There would be some definition of old data, this will be set in the criteria of delete query, so only particular data will be deleted.

How you made append query, same way you should see delete query in query design view.
 
I checked it and there is a delete line with "WHERE" condition.
can u tell me what should I write in Criteria and which field i have to assign this condition?


ThanQ

There would be some definition of old data, this will be set in the criteria of delete query, so only particular data will be deleted.

How you made append query, same way you should see delete query in query design view.
 
Without looking at fields, it may not be possible to exactly tell but if you use Query design view, you do not need to write where instead in the criteria write condition.
 
can u tell me how to write criteria for deletion.

ThanQ

Without looking at fields, it may not be possible to exactly tell but if you use Query design view, you do not need to write where instead in the criteria write condition.
 
Find a snap shot attached as well as that query's SQL below (example only).

DELETE tblPreformTips.PreformPK, tblPreformTips.Picture, tblPreformTips.Preview
FROM tblPreformTips
WHERE (((tblPreformTips.PreformPK)=2));

You can also reference a field from a form in the format below:

Forms!formName.[FieldName]

I hope it helps.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    94.8 KB · Views: 98
A delete query is the correct answer. A delete query will delete an entire row(s) of info. It is written similiar to the way you would write a select query. You only add the field that has the criteria you would like to delete. If you want to delete the entire table but keep the structure in place (keep a blank table) simply add the * field from the table that you want to delete. If you have specific criteria that you want to delete add that field and the criteria to delete. It is a very simple process. I would suggest you make a copy of your DB and play with delete queries. You will understand them very quickly. Remember though you are deleting entire rows of info at a time, not on a field by field basis, that would be an update query.
 
ThanQ guys to your valuable replays
and it has been sort out by delete query.

ThanQ
 

Users who are viewing this thread

Back
Top Bottom