Alex
Alex

Reputation: 6645

Open a form if query returns results on DB open

I have a query that checks for any records that meet a specific set of criteria. I want some VBA or a macro that runs the query on DB startup and then displays a form if the query returns any results. If not nothing should happen.

Upvotes: 1

Views: 253

Answers (1)

Alex
Alex

Reputation: 6645

Answer with help from HansUp (above), put the following in the Autoexec:

If DCount("*", "Query_name") > 0 Then
    DoCmd.OpenForm "Form_name", , , , , acDialog
End If

Upvotes: 2

Related Questions