delete record problem

bauer

Registered User.
Local time
Yesterday, 21:29
Joined
Aug 23, 2001
Messages
77
I would like to delete the current record from a query if a certain condition is true, however, whenever I try this I get an error message stating that database or object is read-only. How do I work around this?
 
You can't delete a record in a query. You have to delete it from the underlying table.
 
thank you
I think I'll try just creating an empty table, and copying only the records that I need. If that's not possible, please let me know.

thanks
 
Is your database attributes set to read only?

I could be mistaken but I think if the query is an updateable recordset you can delete records from there.
If I'm wrong appologies in advance.

D.J.
 
nope, though I tried creating an empty table, and that seems to work, though a new problem has arrisen, if I try to export the file again, using:

DoCmd.TransferText acExportDelim, , "AddressTable", "C:/Addresses.csv", True

the next time, the new data is appeneded to the old file, I want to rewrite it not append.

Thank you
 
acctually scratch that, my problem is deleting the contents of the table
 
Depending on the query, you should be able to delete records through it. Updatable queries exist. Is there a join involved? Because that could make life LOTS more difficult. But simple queries should, indeed, allow record deletion.
 
You don't have to copy records to a temporary table in order to export them. Just create a query that selects the records you want and refer to the query name rather than the table name in the TransferText method.
 

Users who are viewing this thread

Back
Top Bottom