473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,398 developers and data experts.

Extracting/Updating SQL from a QueryDef

NeoPa
32,556 Expert Mod 16PB
To extract the SQL from a QueryDef (saved Access query) it is only necessary to view the query in SQL View. This shows the underlying SQL for the QueryDef and is in simple text form (See Access QueryDefs Mis-save Subquery SQL for problems that may occur with SubQueries in your SQL). When a QueryDef is open (either in Design View or Datasheet View) it is possible to switch to the SQL View simply by selecting View \ SQL View from the menu.

From here it is simple to Copy & Paste it to wherever you need it. Please remember it is always better to post Copy/Pasted work here at Bytes to avoid any inadvertent mistakes that can waste much time.

It is also possible to paste (or simply type) SQL into a QueryDef in this way. Be careful though. Once the SQL has been updated this way Access will disallow viewing the QueryDef in Design View unless the SQL is found to be valid and of a displayable type (UNION queries are the most common of non-displayable types). Sub-queries (Subqueries in SQL) can be handled in Design View. The sub-query is simply displayed as any other record source.

It is wise to switch back to Design View to check the SQL is valid (and test it where possible) before saving away your updated QueryDef. A QueryDef saved while in SQL View will open again in that view.
Oct 11 '11 #1
0 5360

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Shaphe | last post by:
I have a system which allows a user to create a list of predefined reports to print. Each report has a chart object, all the chart objects have rowsource set to "ChartQuery". As I loop through...
2
by: bebelino | last post by:
Hello, this should be an easy one, but I've had always troubles with it. How to pass trough a querydef-variable, form-variable and so on from a function to the caller-routine? Is there a simply...
1
by: VBSponge | last post by:
Hi all. Need help here as I cant see whats wrong... I have a querydef in Access 2k which execs a stored proc in a SQL Server 2k db. I keep getting the following error, and cant stop it for the...
1
by: lgs | last post by:
In an application, I'm creating a QueryDef on the fly, then use DoCmd.OpenQuery to display the results. If the user changes column width, for example, s/he is prompted when closing whether s/he...
6
by: Tim Marshall | last post by:
A2003, but this behaviour also occurred during the same DAO process I'm about to describe in A97. I have a sub procedure which takes two arguments: a querydef name; and an SQL statement...
21
by: Marc DVer | last post by:
I am trying to create a query that can be loaded as a querydef object but not having to assign values to the parameters if I don't want to. Normally when using a parameter query in VBA my code...
4
by: sara | last post by:
Hi - All is fine if I open my form, do something, then close it. However, if I just open it, then press the Close button (or go into design view), I get "object variable or with Block variable...
11
by: Liam.M | last post by:
Hey guys, If anyone could spare sometime to help me out, it would be very much appreciated.....what I am trying to do is automate a "Command" that sends me an Email. I have created a Query that...
2
by: Tommy Hayes | last post by:
Hello all, I have the following code snippet in my Access app: Dim dbQueryDef As QueryDef Set dbQueryDef = CurrentDb.QueryDefs("QUERY_NAME") ' (1) Set dbQueryDef = CurrentDb.QueryDefs(26) '...
6
by: Werner | last post by:
Hi, I try to read (and extract) some "self extracting" zipefiles on a Windows system. The standard module zipefile seems not to be able to handle this. False Is there a wrapper or has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.