Hi. I have a command button on my search form which opens another search results form using the following:
DoCmd.OpenForm "frmSearchResults", acNormal, , Replace(BuildFilter, "WHERE", ""), , acDialog
it works great however I don't want to open the search results form if there are no records because that throws a runtime error for the user. The search results form is based on a query, but the query only serves to select which fields are to be displayed. The form gets filtered not based on the query, but on the form's Filter property which contains the value of BuildFilter.
How can I test whether there are any results before opening the form? I looked at DoCmd.OpenQuery but it doesn't look like it accepts a filter. I'm sure this is easy but beyond my current skills.
Thanks.