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

Query "Hanging" When executed in VBA

Status
Not open for further replies.

jcliff62

Programmer
Feb 29, 2000
1
has anyone encountered queries hanging when the query is executed via docmd.openquery? the query works great when executed directly but hangs when executed from within a module?<br>
<br>
thanks for any help
 
If the query is an action query, and is already open in design view, ie you were testing, had it open, then ran the code, it'll just open in datasheet view, and you'll never get the 'are you sure...' prompt. Not sure if this is the behaviour you're experiencing...<br>
--Jim
 
I use SQL if I'm writing VBA code any way.<br>
Its much faster and you won't see that Query box.<br>
<br>
you can create a query to get it working then copy and paste the SQL code in your VBA code<br>
<br>
Dim db as database, rst as recordset, SQL as string<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = &quot;SELECT * FROM Orders WHERE OrderDate &gt;= #1-1-95#;&quot;<br>
Set rst = db.OpenRecordset(SQL)<br>
<br>
This is very simple one but you get the idea. <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top