0

I have a continuous form in access with multiple text boxes that search a table and return the records that meet all the criteria. It has two buttons, one that filters ("searches") and one that clears all the text boxes ("resets"). It has been working flawlessly for months.

Today, this code started displaying, only sometimes, when I hit esc to clear the textboxes:

" Run-time error '2001': you canceled the previous operation."

This is the line that the debugger highlighted:

Me.FilterOn = False

I am not sure why :/ here is all my code for the reset-command button:

Private Sub cmdReset_Click()
  Dim ctl As Control
  For Each ctl In Me.Section(acHeader).Controls
     Select Case ctl.ControlType
     Case acTextbox, acComboBox
         ctl.Value = Null
     Case acCheckBox
         ctl.Value = False
     End Select
  Next
  Me.FilterOn = False
End Sub

But again, this all was working, and then just started freaking out. I was editing at the time, and the code builder was open, but I was changing the names of labels in the form design view, not messing with the code.

I worried that I was accidentally typing in my code builder instead of in a label, so now the code wasn't recognizing something, but I have been combing and combing and I cannot find anything out of the ordinary/doesn't match up with something.

I have no idea what I am missing or what I did, but any help is MUCH appreciated!

Sarah

YowE3K
  • 23,852
  • 7
  • 26
  • 40
  • Something changed. A DLL? A patch? Installed a new app that overwrote an installed library? Upgrade an app? – nicomp Nov 14 '17 at 01:23
  • *Today, this code started displaying, only sometimes, when I hit esc to clear the textboxes* ... does this error occur on clicking the button or esc? – Parfait Nov 14 '17 at 02:49
  • A full [Decompile](http://stackoverflow.com/a/3268188/3820271) run can remedy sudden VBA errors. – Andre Nov 14 '17 at 06:08
  • Parfait - only when I hit the escape key. – Sarah Cathryn Ashworth Nov 14 '17 at 15:01
  • @Andre - I'll try to decompile it. I am still pretty novice at Access and VBA, and have never compiled/decompiled anything before. How do I compact my database? When do I hold down the shift key, while the new instance of Access is opening? – Sarah Cathryn Ashworth Nov 14 '17 at 21:27
  • @Andre - Alright, I figured out compacting, and I have most of it down, but I am not confident that I am actually decompiling. I was unclear on what to type in the run window. Am I typing the location of the shortcut? Which in this case would be: S:\hscgroups\UNI Provider Referral Database. Do I type the address and then tack on the name of my aacdb and then /decompile? S:\hscgroups\UNI Provider Referral\EPL_2017-11-14.accdb /decompile . I am also still unclear on when I hold down shift (sorry). Is it just while it is opening? – Sarah Cathryn Ashworth Nov 14 '17 at 22:15
  • For /decompile command-line, see the answer by Tim Lentine, step 3. Press Shift when starting the shortcut / your database, and hold it until Access is done (no hourglass cursor). – Andre Nov 14 '17 at 22:40

0 Answers0