G
Guest
Hi, I have created a search form that lets a user enter a company name to
search for. A command button then opens a form and goes directly to
that company's record. If left blank, it just goes to the first record, but
if the company name is not a record, then it opens a new record to be added.
How can I code this so that if the company name is not recognized, a message
box opens saying that no record was found? Here is the code I have:
Private Sub cmdSearchButton_Enter()
If Not IsNull(txtCompanyNameSearch) Then
DoCmd.OpenForm "frmCompanyInformation", WhereCondition:="CompanyName =
Forms!frmSearchByCompanyName!txtCompanyNameSearch"
Else
DoCmd.OpenForm "frmCompanyInformation"
End If
End Sub
search for. A command button then opens a form and goes directly to
that company's record. If left blank, it just goes to the first record, but
if the company name is not a record, then it opens a new record to be added.
How can I code this so that if the company name is not recognized, a message
box opens saying that no record was found? Here is the code I have:
Private Sub cmdSearchButton_Enter()
If Not IsNull(txtCompanyNameSearch) Then
DoCmd.OpenForm "frmCompanyInformation", WhereCondition:="CompanyName =
Forms!frmSearchByCompanyName!txtCompanyNameSearch"
Else
DoCmd.OpenForm "frmCompanyInformation"
End If
End Sub