DCount – “You canceled the Previous Operation” error

Really really quick tip

It seems that if you use dashes (-) in your field names for any table, and try to run functions on them in VBA like “DCount()”, you’ll keep encountering a Run-Time Error ‘2001’ “You canceled the previous operation”.

My recommendation: get rid of dashes and underscores in your table field names.

Edit: You will also get this error if you request incorrect fields names in the table. For instance, you are trying to ask for a count of customerIds and write the code as “DCount(“customerId”, “tblCustomers”)”, when the field in the actual table is ‘intCustomerId’ or something along those lines. Sounds obvious but Jet gives you back a non-helpful error message.

Published by

Darragh

GEEBAN DEATH MONKEYS!