Unbound Form Open By Parameter Query

  • Thread starter Thread starter K
  • Start date Start date
K

K

If you use Visual Basic to run a parameter query and then
open an unbound form based on what you entered as the
parameter, the form comes up blank (no fields showing) if
what you entered is not found. I have tried so many
different ways to write an If/Then phrase which will take
over if the parameter is not found, but I have been
unsuccessful. Is there a way to do this with code?
Thanks.
 
A form will only appear completely blank (no text boxes showing) if:
- it is bound, and
- there are no matching records to show, and
- no new records can be added, and
- there are no controls in the form's header/footer.

If you are opening a recordset and then assigning the Recordset to the form,
you might check the RecordCount of the Recordset before assigning it.

If you are just providing a way for the user to filter the form, you might
use a text box in the form header where the user can enter the filtering
information they want.

If you want the form to display a blank record when there are no matches,
you could change its AllowAdditions property back to Yes, and cancel its
BeforeInsert event if you don't want the user to be able to add records.
(This suggestion assumes it is an updatable recordset in the first place.)
 
Back
Top