Access 2007 Contacts Template - error "You can't disable a control

Y

yrba77

Hello, I have slightly modified the Access 2007 Contacts Management template
for use as a contacts database at work and I'm having an issue with the "Show
All Records" control object. When I perform the "Quick Search", I get my
results with no problem. I then click "Show All Records". This works fine
unless....

I was testing the modified template and at one point I did a manual "Sort
A-Z" on the last name field. After performing that sort, I tried to click
"Show All Records" again but when I did I received the error "You can't
disable a control while it has the focus" Now, every time I try to use the
"Show All Records", this error pops up. If I click OK on the error box, it
does display all of my records again so the button is still working but the
annoying error keeps coming back as well. The error specifics are as
follows...

Macro Name: Contact List : cmdShowAll : OnClick : Embedded Macro
Condition: True
Action Name: SetValue
Arguments: [Forms]![Contact List]![cmdShowAll].[Enabled], 0
Error Number: 2950

If anyone can help, I sure would appreciate it. I am relatively new to
Access, still getting used to it.

Thank you
 
Y

yrba77

Hello, I should note that when I click the "Clear All Sorts" button on the
"Sort & Filter" area, then the "Show All Records" begins to work again.
 

BrG

Joined
Jun 17, 2009
Messages
1
Reaction score
0
Hi,

I also had a same issue. Since I found a solution, thought that just might write it here so the thread has a solution (probably late for yrba77 and Fozz, though).

As Klatuu from this thread has explained (http://groups.google.com/group/microsoft.public.access/browse_thread/thread/a946c42f364c69a6?pli=1), the problem lies in the fact that the "Show All Records" button is in focus when macro is trying to disable it. As I am Access novice myself, I am not sure why this error is occurring.

Workaround is to set focus on any other control in the form before macro tries to disable the button. For all those that are also novice, here is what to do:
- open Contact List in Design view
- left-click Show All Records button and choose Build Event...
- before the row containing SetValue [Forms]![Contact List]![cmdShowAll].[Enabled] insert another row
- as an Action, choose GoToControl and as a Control Name put cmdGo (that's the Go button for search)

That's all - before the button is disabled (SetValue action mentioned above), we now set focus on another button and the problem is resolved.

Thanks Klatuu for original post!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top