Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Requery Problem

Status
Not open for further replies.

walbr02

Technical User
May 15, 2002
14
US
I have two very similar search forms that show the results in a subform. I have one that works fine, but the other one will not requery. It is not necessary for the form to be linked to the subform, but I think that that has something to do with the problem. Here is the code for both

CurrentDb.QueryDefs("qrySearchT").SQL = strSQL
Me.findTG30sub.Requery


If there is a better way to do this, any input would be greatly appreciated!
Thanks,
Brian
 
Me!findTG30sub.Form.RecordSource = strSQL Jim Kraxberger
Developing Access solutions since 1995
 
Is that first line supposed to be changing the SQL property of the subform's record source? You sure can't do it that way. You can't change the properties of a QueryDef once it's been added to the database, you can only change them when you're creating one in code.

I suspect the Requery is working fine, but that you only think you're modifying its record source.

Since you already have an SQL statement built, you can just assign it to the subform's RecordSource property:
Me.findTG30sub.Form.RecordSource = strSQL
You don't even need the Requery if you do that, because changing a form's RecordSource automatically requeries.

(Note: A form's RecordSource property can be the name of a table, the name of a query, or an SQL SELECT statement.) Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top