Find Command

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
 
J

Joe

I'm not sure that I can help you with your question but I
was wondering if you could help me with mine. I have a
database right now that has two columns to it: a new item
and the old item column. I would like to have a find
command that would allow me to search just one column and
have the findings be entered into the fields of one column
and vice versa. Right now, when I hit the find record
command button to search it updates both columns because
the field names are the same. Is it possible for the
search to be restricted to just one side of the form and
not search the second column? I just want to limit the
search if there is such a way and not update both columns.
 

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