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

Status
Not open for further replies.

walbr02

Technical User
May 15, 2002
14
US
I have a search form with a couple of different criteria that has a subform that displays the results. I have had no problems using strSQL to change the query based on the user input, but I cannot get the subform to requery or refresh from the cmdButton_click
subroutine:

Dim strSQL As String

If Not BuildSQLString(strSQL) Then
MsgBox "There was a problem with your search"
Exit Sub
End If

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

The QueryDefs works, but the requery just won's work.
I've searched through the forum ad-nauseum for this, and have tried everything, but I still can't get this to work.

Any help would be greatly appreciated!!!
Thanks,
Brian
 
I think I had a similiar problem. I think I just declared
a form object, assigned the subform to it, and then did a requery on the form object.
Dim someform as form

set someform=forms!myform!findTG_3_0sub

someform.Requery
You might have to play with a little bit but that's the general idea.
 
thanks VBA jock,
I did something similar that seems to work: the main form did not need a record source, since it was input only, but I added the table that it was searching as a source, and then it recognized the requery. It seems to be working now.

Thanks for the reply!
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top