473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting sql string from a query

23
Is it possible to programmatically get the sql string of a query object?
Jul 13 '09 #1
3 23728
jimleon
74
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
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
Fantastic, thank you sphinney!
Jul 14 '09 #4

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

Similar topics

3
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...
4
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...
4
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...
2
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:...
2
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...
4
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> ...
1
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)...
3
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...
10
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.