DoCmd. Openform Error Message IF no records found...not getting it

P

Peter

Here I am again, what code do I need in order to return a MsgBox message IF
no records were found in Form View all Companies control CompanyName? Thanks
for all patience so far…Thanks!


Private Sub OpenCompanyFromMenu_Click()
On Error GoTo Err_OpenCompanyFromMenu_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "View all Companies"

stLinkCriteria = "[Company]Like'*" & Me![CompanyName] & "*'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenCompanyFromMenu_Click:
Exit Sub

Err_OpenCompanyFromMenu_Click:
MsgBox Err.Description
Resume Exit_OpenCompanyFromMenu_Click
 

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