Query Not Refreshing

music_al

Registered User.
Local time
Today, 23:44
Joined
Nov 23, 2007
Messages
200
What is wrong with this code ??

DoCmd.OpenQuery "Siblings_Query", acViewNormal, acReadOnly
Me.Refresh 'Refresh the query
DoCmd.OpenForm "frm_Pupils"
Me.Refresh

The query works fine when I open it manually and refresh it manually. Its pulling criteria from a control on a form WHICH IS OPEN.

When I try to run it from the code above, it doesnt refresh.

Thanks

Al
 
'Me' is a reference to the object in which code is currently running. This object is in no way related or connected to your query.
 
thanks lag.

Ive since changed the code (which runs On Current) to...

DoCmd.OpenQuery "Siblings_Query", acViewNormal, acReadOnly
DoCmd.Requery
DoCmd.OpenForm "frm_Pupils"

...and the query refreshes perfectly each time. However, I have created a sub form from my query and tried to embed it within my master form. The master/child fields are set, but the sub form is always empty - unlike the quer itself that shows the values I expect to see. What am I doing wrong ?

Al
 
Maybe nothing. The idea of a subform is that it only shows a subset of records filtered by the links to the main form. Are you certain there should be records in the subform?
 
Ive kind of worked round it by putting a button on my form which opens the query but Im puzzled why I cant drag the query onto my form.
 

Users who are viewing this thread

Back
Top Bottom