J
John Kozma
I have a form to which I've added a command button that executes the Find...
command from the Edit menu on the Form menu bar, viz.,
Private Sub FindRecords_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 9
'Application.RunCommand acCmdFind
End Sub
The command allows the selected control or the entire form to be searched.
Searching the selected control seems to work okay. (I added code to change
the focus back to the previously selected control so that the command
behaves the same way from the button as it does from the menu.) However,
the search does not always work correctly when I search the whole form. In
particular, the command would only locate the "Find What:" entry in the
current record, and would not display the "...not found." message when no
further instances were found. At first I thought the problem was the OS,
because I first noticed it on two different machines running Windows ME, but
not on the XP machine I regurlarly use. On one of the ME machines, running
the Find... command and searching the entire form also seemed to interfere
with the print command. I tried changing to the RunCommand method call
commented out above (from the call to the DoMenuItem method of the DoCmd
object. The db was created in Access 2000.) To the best of my
recollection, the same errant behavior of the Find... command resulted on my
XP machine that I had observed on the ME machine. Before posting this, I
tried to run the command both ways again so I could describe the behavior
more precisely. Now, however, both calls seem to work fine on XP. I have
not been able to try the RunCommand call on the ME machine.
Any suggestions about what might be causing the Find... command to
misbehave?
Thanks,
John Kozma
command from the Edit menu on the Form menu bar, viz.,
Private Sub FindRecords_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 9
'Application.RunCommand acCmdFind
End Sub
The command allows the selected control or the entire form to be searched.
Searching the selected control seems to work okay. (I added code to change
the focus back to the previously selected control so that the command
behaves the same way from the button as it does from the menu.) However,
the search does not always work correctly when I search the whole form. In
particular, the command would only locate the "Find What:" entry in the
current record, and would not display the "...not found." message when no
further instances were found. At first I thought the problem was the OS,
because I first noticed it on two different machines running Windows ME, but
not on the XP machine I regurlarly use. On one of the ME machines, running
the Find... command and searching the entire form also seemed to interfere
with the print command. I tried changing to the RunCommand method call
commented out above (from the call to the DoMenuItem method of the DoCmd
object. The db was created in Access 2000.) To the best of my
recollection, the same errant behavior of the Find... command resulted on my
XP machine that I had observed on the ME machine. Before posting this, I
tried to run the command both ways again so I could describe the behavior
more precisely. Now, however, both calls seem to work fine on XP. I have
not been able to try the RunCommand call on the ME machine.
Any suggestions about what might be causing the Find... command to
misbehave?
Thanks,
John Kozma