Hi, following is the description of scenario and problem encountered.


Scenario:
=========

I just upsized my Access 2000 application to Access ADP. I am calling a function to create runtime query.
Everything works fine. When I call DoCmd.OpenStoredProcedure I get Error: 7874.
But if I go to Debug Mode and then to queries list on Project Window and press <F5> (Refresh) Button. Query name appears on the list. On debugger if play the code again. Everything works fine.


Problem:
========

I want to refresh list of queries through code. How can I do that?

Function listing is given below:

Public Function CreateQuery(sQryName As String)

Dim sSql As String

sSql = "SELECT TblAddress.FirmName, TblAddressDetail.Adressering, TblAddress.SirName, TblAddress.FirstName, TblAddress.MiddleName, TblAddress.Street, TblAddress.HouseNo, TblAddress.HouseArea, TblAddress.Postcode, TblAddress.City, TblLand.Country" & _
" FROM ((((TblMailMerger INNER JOIN TblContacts ON TblMailMerger.ContactID = TblContacts.ContactId) INNER JOIN TblAddress ON TblMailMerger.Category = TblAddress.ClientType) INNER JOIN TblAddressDetail ON (TblAddress.Title = TblAddressDetail.TitleCode) AND (TblAddress.TelId = TblAddressDetail.TelId)) INNER JOIN TblCountry ON TblAddress.CountryID = TblCountry.CountryId) INNER JOIN TblTypeBriefDetail ON (TblTypeBriefDetail.TelId = TblAddress.TelId) AND (TblMailMerger.BriefId = TblTypeBriefDetail.BriefId)" & _
" WHERE (((TblMailMerger.Status)=0))"

sSql = "create Procedure " & sQryName & " as " & sSql & " RETURN"

CurrentProject.Connection.Execute (sSql)

DoCmd.OpenStoredProcedure sQryName, acViewDesign

End Function


Any help in this regard, will be highly appreciated. Thank you!