Hello
I'm using an XLSX database and I'm having trouble finding a code to delete a record.
Can anyone help me with this?
(Sorry for the spelling, I'm Brazilian and I don't write English very well)
Hello
I'm using an XLSX database and I'm having trouble finding a code to delete a record.
Can anyone help me with this?
(Sorry for the spelling, I'm Brazilian and I don't write English very well)
For a workbook to contain code/macros it has to be saved as macro enabled with an extension .xlsm not .xlsx
see big yellow banner 'how to upload your workbook' you will then stand a better chance of getting help and a solution.
Torachan,
Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.
You are probably using ADO and SQL to query the "xlsx" file. Unfortunately, ADO does not support deleting records when the database is an Excel file. You can only write a "blank record" on a record that you actually want to delete.
As Haluk mentioned, the record cannot be deleted. But you can use an additional column in the table, such as Deleted, and when you need to delete a record, mark that record with True in the Deleted column. This, of course, involves changing SQL queries, as you will have to additionally filter the data by the Deleted column.
Artik
Am I misunderstanding the problem - surely the simplest is to save the .xlsx as .xlsm then write the 'deletion' macro in the same file rather than 'going around in a complex circle' of disjointed processes.
As an « XLSX database » is a non sense Better use an Access database file for example
@ajwebtv01: you need to upload examples of both files with enough (redacted) data to simulate the processes and requirement.
As you have an .xlsm file with the query code, I would have thought it fairly straightforward to write VBA code to find and delete records in the .xlsx file. No body is going to guess at a solution based on the detail provided so far.
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks