Don't run query when form is loaded

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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.
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top