Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 3rd, 2007, 06:35 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default SELECT from SELECT query?

I have a lot of queries which are along the lines of

SELECT * FROM CUSTOMER WHERE ...

We've added a limitation to the CUSTOMER table (and renamed it to CUSTOMER_MASTER) and now need to do a SELECT from a SELECT. We had done a search/replace in our central query module so that the above becomes:

SELECT * FROM (SELECT * FROM CUSTOMER_MASTER WHERE <limitation>) AS CUSTOMER WHERE ...

This would (I am pretty sure) work with SQL, but Access complains of an error in the FROM. Re-writing all the queries isn't an option because there's a serious quantity of them, which is why we opted for a search/replace in the query module (a set of functions that are passed a query and return the recordset).

Hope this explains things and any help would be appreciated.

Regards,

Sean Anderson
__________________
Regards,

Sean Anderson
Reply With Quote
  #2 (permalink)  
Old October 12th, 2007, 12:40 AM
Friend of Wrox
 
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When you change table names, there really is not shortcut to properly updating the queries. IMHO, All the queries should be fixed not patched. Your solution seams to be a harder way and will probably slower executing.

You may want to consider the product Speed Ferret.

You may also find this useful:

Public Sub UpdateFieldNameInQueries()

Dim qdf As DAO.QueryDef 'Note: you may need to set a reference to DAO

Const cFrom = "BRANCH ID"
Const cTo = "BRANCH_ID"

With CurrentDb

For Each qdf In .QueryDefs

qdf.SQL = Replace(qdf.SQL, cFrom, cTo,,,vbTextCompare)

Next qdf

End With

End Sub
from:
http://www.utteraccess.com/forums/sh...ost1513505&Zp=



Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Query gregalb SQL Server 2000 2 November 15th, 2007 10:56 PM
Need help on select query arul1984 SQL Server 2000 2 July 4th, 2007 01:49 AM
Select Query Help dbartelt Access 1 June 13th, 2005 08:06 AM
Select query help minhtri SQL Server 2000 4 March 28th, 2005 06:59 PM
select query collie SQL Server 2000 2 January 17th, 2005 03:13 AM



All times are GMT -4. The time now is 05:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.