473,748 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting sql string from a query

23 New Member
Is it possible to programmaticall y get the sql string of a query object?
Jul 13 '09 #1
3 24104
jimleon
74 New Member
If you go into the desing view of the query, right click on it and select 'sql view' you will see the query in text format.
Jul 13 '09 #2
sphinney
69 New Member
charli:

Try the following code to obtain the SQL for a query object in the current database:

Expand|Select|Wrap|Line Numbers
  1. Private Function GetQuerySQL(MyQueryName as String) as String
  2. Dim QD As DAO.QueryDef
  3.  
  4. Set QD = CurrentDb.QueryDefs(MyQueryName)
  5. GetQuerySQL=QD.SQL
  6.  
  7. End Function
FYI, the SQL property of a DAO.QueryDef object is read/write.

Regards,
sphinney

@charli
Jul 13 '09 #3
charli
23 New Member
Fantastic, thank you sphinney!
Jul 14 '09 #4

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

Similar topics

3
4843
by: Jamie Wright | last post by:
I have been using PHP for a while now, although my knowledge of the inbuilt functions is pretty lacking. I am trying to remove a 'space' from the middle of a string. I reckon I could split the string at teh space, trim each string then join them, but this seems a little long winded. Is there a command to remove certain charachters? Or even better white space? I've searched the PHP manual with little luck. Any help would be appreciated. ...
4
1404
by: wnstnsmith | last post by:
Dear all, Suppose there is a table whose records contain a textfield TXT, and a query that returns a subset of that table. Is it possible to have that query return all the TXT-fields gathered together in one string? I really have no idea as to how to tackle this. For clarity, here's an example of what I mean: there are three tables
4
1410
by: Regnab | last post by:
This might be a little complicated to explain. I have a table (Paddocks) with 4 property codes as fields. In each of these fields is a list of paddocks (varying number). My code at the moment runs this query 4 times (for each property), and I need the parameters of the query to change depending on which property is being checked. The reason I don't just type the properties in as criteria is because I want the user to be able to add...
2
1162
by: RAB | last post by:
I tested my code on my local computer and it worked fine. When I uploaded it to my webserver at Godaddy.com, I get the following error... Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. The line of code with the error is: objCmd.ExecuteNonQuery
2
1489
by: RichF | last post by:
I am trying to query a text string and remove everything other than 6 characters that will always be in the format DJ#### (as in the letters "DJ" and then 4 numbers). The problem I am having is that it can be anywhere in the text string. What I currently have is the following SQL statement, but it doesn't account for any occurences with text before the DJ#### string. is the Table name and is the field with the text string in question....
4
1584
by: British | last post by:
Hey guys need some advice I have this simple string query code that collects data from the "form collection" page below (1). 1.FORM.ASP <html> <head> <title>Form collection</title> </head> <body> <hr> <FORM method="POST" action="form_process.asp">
1
4747
by: chitara | last post by:
is there any posibility to block mysql port or someting? I am getting "Error ,query failed" during adding any data through the admin panel of that website:-( same softwares(php, mysql and IIS) with the same script woking fine in my local server but in the main webserver its giving the above message. More over couldn't edit the data also over there. Thats why I am asking, is there any posibility............. I don't have permission to...
3
1065
by: Bucs44 | last post by:
I'm still new to SQL and am trying to pull up a query that lists the order number, customer ID, and the number of days between order and shipment sorted by longest delivery time to the shortest, for all orders in 1996 only. I think I have to use DATEDIFF on this but have never used it before - any help would be greatly appreciated.
10
1609
by: ptq2238 | last post by:
Hi, I've been experimenting further to understand about ordering strings. I had changed the code which tested ordered a list of char ( which worked ) to string but it's not giving the results I was expected. I was expecting to have the strings in an increasing order. Now, I'm getting confused and would appreciate if someone can explain why I'm getting these results is greatly appreciated. Am I going about this the correct way ?
0
1022
by: j.lendholt | last post by:
Hey Folks, it's some years ago i wrote applications in VB respectively VB .NET 2003. We have a java-application based on java-scokets. We try to connect to the server, send up a string, let the server-app work and wait for a server-response. The VB-App connects correctly to the java-app in port 11111 on our
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.