how do I update a subform based on a query ?

f_disk

Registered User.
Local time
Yesterday, 19:45
Joined
Jul 18, 2006
Messages
45
I would like the subform in the lower left corner to be blank when
I open the program. It is populated from my tblClients table.
How it works in general is you select "x" number of items from the
list box...hit the search button and the results go through a query
and then show up in the subform.
everything works ok but, like I stated I would like the subform to
be blank when the program is first started up.
It seems to be retaining information from the last start up in the
subform box.

Thanks for your help...it's coming along great so far...
see attached doc...
 

Attachments

  • SUBFORM1.JPG
    SUBFORM1.JPG
    89.5 KB · Views: 143
Last edited:
It depends how you are going about it.

Does your search alter and run a query that you have created?
or does it run some code that alters the row source of the subform?
 
runs from query

If this helps you here is the code for the search button which you
click after you have selected items from the list on the right.
Private Sub btnSearch_Click()

' Update the record source
Me.frmsubClients.Form.RecordSource = "SELECT * FROM qryClientData " & BuildFilter

' Requery the subform
Me.frmsubClients.Requery
End Sub

Thank you for your help...
 
The record source when the form loads will need to be blank (or have a where clause like 'WHERE ID = 0') to stop anything showing.

Try putting this code in your Form Load event

Code:
' Update the record source
Me.frmsubClients.Form.RecordSource = ""

' Requery the subform
Me.frmsubClients.Requery
 
hmmm not working

I have uploaded the database to this url...
It's about 5.75 megs...sorry...

Maybe by looking at it you can tell what the problem is...
I do know that the subform is run through the query and maybe
we need to stop it there at the initial load up.

While you looking...
Could you also take a look at the clear button and see if there
is a way to get it to also work on the subform when you use it.

thanks for the help...im not real good at this as you can tell...
http://www.savefile.com/files/73697
just click on the download button..
 

Users who are viewing this thread

Back
Top Bottom