[AccessD] FW: Refresh QueryDefs?

Rocky Smolin rockysmolin at bchacc.com
Mon Nov 29 18:06:24 CST 2010


Thanks Dan.  Will forward to the poster.

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Monday, November 29, 2010 11:36 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] FW: Refresh QueryDefs?

I have a module with the following procedure at the top:

Private Sub Refresh()

    DoCmd.SetWarnings True
    Application.Echo True
    DBEngine(0)(0).QueryDefs.Refresh
    DBEngine(0)(0).TableDefs.Refresh
    DoCmd.Hourglass False

End Sub

For several reasons I just click in the procedure and run it.  This does
allow my code to recognize a new saved query.  I do use DBEngine(0)(0)
instead of CurrentDB.

Also try removing () after CurrentDB.

HTH,
Dan


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Monday, November 29, 2010 12:27 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] FW: Refresh QueryDefs?

Does anyone know the answer to this question?
 
TIA
 
Rocky
 

  _____  

From: Hartje, Charles [mailto:CHartje at sandiego.gov]
Sent: Monday, November 29, 2010 10:14 AM
To: Barry Hynum; 'Doug Murphy'; 'Bob_Heygood'; Hartje, Charles; 'Darrell
Burns'; 'Dixon'; 'Jackie Murphy'; 'JKA Joe K Anderson'; 'Mike Dwyer'; 'Polly
Arndt'; 'Rocky Smolin'
Subject: Refresh QueryDefs?



Group,

 

Oftentimes when I'm working in the VBE with a new query I've created using
the query designer, I get an error that says the (query) object isn't found.
I figure the error occurs because the QueryDefs collection doesn't yet
contain the new query.  Restarting the database always fixes the problem -
but what a nuisance.

 

If it were just a matter of refreshing the collection, you'd expect to be
able to run a line of code from the immediate window such as:

 

Currentdb().QueryDefs.Refresh

 

But that doesn't take care of the problem.  I still have to close and
restart the database if I want to work with the new query from the VBE using
the DAO Recordset object.  

 

Does anyone know  of a solution.

 

 

 

 

Charles Hartje

City of San Diego | Engineering and Capital Projects

Project Implementation and Technical Services | Information Systems -
Engineering Application Support

Ph: 619.533.5131  Mobile: 619.609.5023

email:   <mailto:lbobis at sandiego.gov> chartje at sandiego.gov

 

"Working Together to Engineer a Better Tomorrow"

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list