473,699 Members | 2,638 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 24049
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
4839
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
1403
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
1406
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
1160
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
1488
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
1582
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
4743
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
1061
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
1603
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
1020
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
8623
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
9192
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
9054
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...
1
8939
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6545
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
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.