'Find' Sometimes doesn't work on a converted 97/2003 db

H

Helen

I have converted several Access db's from 97 to 2003.
They all have similar code, and have a 'Find' button in
many places. I have found that this intermittently
doesn't work. Where is does work, I have put a break
point in the code, to run it again only to find it then
doesn't work. The error is 'The command or action FIND
isn't available now'. At other times when I have got the
Find box up and tried to find something, it gives another
error saying the control the macro is attempting to
search, can't be searched. The code behind the Find is:
DoCmd.DoMenuItem A_FORMBAR, A_EDITMENU, 10, , A_MENU_VER20

Any help would be greatly appreciated.
 
C

Chris Mills

I would suggest that DoCmd.DoMenuItem, and constants in the style A_FORMBAR,
are obviously legacy code from Access 2.0 (I have the same myself <embarrassed
grin>)

As Joan intimates, the Runcommand is generally a more reliable method, because
it is not dependent on implied menus. Of course, it might still fail if the
action is inappropriate at the time.

This change was made certainly as far back as Access97, and probably Access95.
By and large, Microsoft have done a good job of retaining legacy methods (I
can't speak for A2003), though sooner or later you should change to more
modern code.

(Howzat, Microsoft?)
Chris

(I couldn't immediately find the meaning of "10", since Access v1.1 is "11".
There is an extensive description of DoMenuItem and it's limitations and
fixes, in on-line help at least as far as Access XP)
 
C

Chris Mills

Where is does work, I have put a break point in the code,

Also, breakpoints in code tend to not work in this type of thing, because code
like that depends on the "active window" being "active", and a breakpoint
tends to change that environment. Place breakpoints only in code where the
"active window" is not critical, ie somewhere entirely before or after that
type of processing.

Chris
 

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