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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform query refresh problem

Status
Not open for further replies.

zathrus777

Programmer
Mar 31, 2003
30
GB
I have a dialog I have created which has a subform which I wish to change the contents of by pressing command buttons. I have the source as a query and use:

CurrentDb.QueryDefs("query6").SQL = "SELECT blah blah"

to change the query itself but cannot get the subform to refresh and show the new query without closing and reopening the form.

Any ideas?
 
Well I managed to get this to work - can someone tell me whether they would have done it a different way?

CurrentDb.QueryDefs("query6").SQL = "SELECT * FROM felearnaim;" change the query - does not update screen
form_frmpostcode.subFormQuery.SourceObject="qryPostcodeUpdateL17" 'set the new source - this updates screen


And again

CurrentDb.QueryDefs("query6").SQL = "SELECT DISTINCT felearnaim.A48a, felearner.ID, felearner.L32, felearner.L33" & _
" FROM felearner INNER JOIN felearnaim ON felearner.ID = felearnaim.STUDENT " & _
" WHERE (((felearnaim.A48a) Like '??[B,E,G]*') AND ((felearner.L32) Like '71') " & _
"AND ((felearner.L33) Not Like '1.1000' And (Not (felearner.L33)>'1.1000')))"

' this is my new query

form_frmpostcode.subFormQuery.SourceObject="query.query6"
' then set the source which updates the screen

 
Pretty basic question here:

If my main form is frmMain and my subform control name is frmSub and the query that I want to update the subform is qryUpdate, how would I write the following statement

form_frmpostcode.subFormQuery.SourceObject="qryPostcodeUpdateL17"

Anna Jaeger
iMIS Database Support
 
Have you tried this ?
Forms!frmMain!frmSub.SourceObject

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top