Don't run query when form is loaded

G

G

I am creating a search form that has a subform to show the results. When I
load the form, the subform is automatically running the query and then
showing the results. Is there an option or a vb script to choose not to run
the query when loading the form. I have the vb coding to requery the options
selected in the form and to show the results.

Thanks!
 
P

pietlinden

G said:
I am creating a search form that has a subform to show the results. When I
load the form, the subform is automatically running the query and then
showing the results. Is there an option or a vb script to choose not to run
the query when loading the form. I have the vb coding to requery the options
selected in the form and to show the results.

Thanks!

don't set the rowsource for the subform until after the form loads -
you'd need to use a button to do it, I think.
 
N

Naeem

Leave the rowsource of the subform blank, nothing in it.

then in the event that you requery the subform: add this line before
the requery:

subform.recordsource = "cut and paste the recordsource of the subform
here. "

then requery the subform
 
G

G

I tried using the following code to

Private Sub Form_Load()
cmdClear_Click
Me.frmInquiry.Form.RowSourceType="Table/Query"
Me.frmInquiry.Form.RowSource=""
End Sub

How do you set the rowsource to zero in a query? I am not using a combo
list or any dropdown menu.

The main form as 4 unbound text boxes. The subform contains the information
from a query. The best way for me to eliminate all data in a query is to
search for null value in Field 1.
 
Top