Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 4th, 2005, 12:57 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query wont work unless I copy and past into new on

I am createing a query in VBA, saving it, then running it, and it does not work.

But if I go into SQL mode, copy and past it into a new query it runs. I have comparied the one that does not work and the one that does and they are identical.

What's up?!!

Here is my code to create it:

Dim dbsNorthwind As Database
    Dim qdfNew As QueryDef
    Dim qdfLoop As QueryDef
    Dim prpLoop As Property

    Set dbsNorthwind = CurrentDb 'OpenDatabase

    ' Create new QueryDef object. Because it has a name, it is automatically appended to the QueryDefs collection.
 Debug.Print strSQL_String
Set qdfNew = dbsNorthwind.CreateQueryDef("YourQueryResults", strSQL_String)
Old March 4th, 2005, 02:22 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Mitch

Where do you have your strSQL_String

Set something like this

strSQL_String = "SELECT * FROM Table"


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Query rsm42 ASP.NET 1.0 and 1.1 Basics 2 January 24th, 2007 02:11 PM
Adodc connections variable wont work, need help honam00000 VB How-To 1 December 10th, 2006 11:21 AM
code clinic - Why wont example asp code work? jardbf Classic ASP Basics 3 April 27th, 2006 06:22 PM
JetComp Wont Work .....HELP!! timmaher Access VBA 3 August 25th, 2005 01:38 AM
code to copy a query recordset to a file Ivan Access VBA 9 October 31st, 2003 06:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.