open search form blank

H

HL

I want to open a search form blank so that the user won't see anything on the
form until a specific record is chosen, say from a combo box. Is it possible
that I don't have to set the where condition as "new" to do so?
 
A

Allen Browne

The form will show no records if you add this code to its On Open event
procedure:
Me.Filter = "(False)"
Me.FilterOn = True

If all the controls in the detail section then disappear, see:
Why does my form go completely blank?
at:
http://allenbrowne.com/casu-20.html
 
H

HL

Thank you very very much Allen, it helps. I have one more question. As you
have predicted, everything disappears when I apply this filter. I put the
combo box at the form header section to at least make the selection possible,
so is it the only way to do so?

Thanks again for your help!
 
A

Allen Browne

Yes: putting the filter boxes into the Form Header section makes sense
(though sometimes they can play up there too.)

The other alternative is to use an updatable RecordSource of your form, and
leave AllowAdditions as Yes. Then block the addition of new records by
cancelling the form's BeforeInsert event. That's my preferred approach where
applicable, but if you can't use an updatable source, this option doesn't
apply, because there won't be a new record anyway.

For an example of the way I usually create search forms, see:
http://allenbrowne.com/ser-62.html
 
Top