I have a form that the user enters a number into and when they click on the "OK" button a query is run which finds records in an linked SQL table. After the query is run, another form is opened, the number entered in the first form is there and based on this number, a sub form is loaded. Here is my problem, if there are not matching records in the linked SQL table I want an error message to appear and I want to cancel the opening of the second form. How can I count the number or records returned by the query. I tried the DCount function but I have not been able to get it to work. You help is much appreciated.