docmd.domenuitem

G

Guest

I have a search button on the form and run the access search form.

I wanted to inform user to add data if the data not found from database.

I found that Access using docmd.domenuitem

"DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70"

Can I get any reponse from above code to know the data does not exist to add
some coding here?

Any information is great appreciated
 
A

Allen Browne

As you found, DoMenuItem returns no value, so you don't know if the find
succeeded.

A different approach is to FindFirst in the RecordsetClone of the form. You
can then test NoMatch, and take action.

For a simple example of using FindFirst and popping up a MsgBox if not
found, see:
http://allenbrowne.com/ser-03.html
 

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