Usually even there's no data returned, the form will still be opened with no data. Not go blank. If it's going blank, it means something wrong with the query or the unjoined relationship. One way, you can set the query property to Dynaset Inconsistent to return no data instead of blank.
However, if you just think of canceling the form opening when there's no data, I'll say on Form_Load, create recordset, if isnull(rs.recordcount) then close form. This can be done through code or macro (cancelEvent).
I have a similar problem. I have forms with subforms based on pass-through queries. Sometimes the forms will open with an empty set.
I would like to show the form with blank data; however, the main form opens blank, and the subform brings up an error (err# 2455). I link the recordsource to the form through code, not through design view.
I tried setting the form and subform as Dynaset Inconsistent, as described above, but this did not help.
Any idea how to open a form based on empty data showing empty fields instead of a blank form?
No, AllowAddition property was already set to Yes. Still blank form and an error for the subform (apparently you can't link a subform to empty data). Any other ideas?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.