sa****@hotmail.com wrote:
sa****@hotmail.com wrote:
Hello,
Thank you for your help. I have another issue. When I click on the
checkbox, it does not send that particular record to the cannibalized
table. It will send the first record or all the records depending on
what I select in the Query properties, the Top Value = "1" or Top Value
= "All". I also want to be able to delete that record once it has been
sent to the cannibalized table. Is there a specific code that can help
me with this?
Thank you again.
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendQuery"
DoCmd.OpenQuery "qryDeleteQuery"
DoCmd.SetWarnings True
On Error
DoCmd.SetWarnings True
The checkbox doesn't do anything. It must marks the record.
And what are you doing with Top Value predicates? That has zero to do
with what you want.
Just create a query to find all the records that are checked.
SELECT...
FROM MyTable
WHERE blnCannibalized=True
then turn that into an append query and save that under a new name
qappCannibal
then turn the select query into a delete query and save it.
Of course, if you wanted to have LOTS of fun, you could be secure and
wrap the whole mess in a transaction so both queries run as a single
unit.
If you look up BeginTrans in the VBA help, it'll show you how to do it.
Oh, and mess with a dummy DB first. When you have it working, move to
the real deal.