473,738 Members | 3,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Challenge: SQL STMT for Retrieving Content(SQL) of Saved Queries

I understand it's easy to list all saved queries of a given Access
database via Msysobjects system table. However, I have not seen any
posting over this NG or other similar ones that also include SQL
statement(conte nt) of these queries, though I've noticed some VB code
for that. Is that because it's simply impossible to get a query
content (not query resultset) from a SQL stmt?

Thanks in advance.

Nov 13 '05
35 2547
"NickName" <da****@rock.co m> wrote in
news:11******** **************@ g14g2000cwa.goo glegroups.com:
OK, I tried the help file, and if my understanding is correct the
last three arguments are all optional, though here I explicitly
include the acViewNormal argument, and I also tried without it.
Both failed. Now it seemed that it's syntax error but something
else, error code # 2486

DoCmd.OpenRepor t strReport, acViewNormal
' try the following (not to include the acViewNormal arg)
' DoCmd.OpenRepor t strReport
The next line will fail because the OpenReport command is commented
out.
strTemp = Reports(strRepo rt).RecordSourc e
DoCmd.Close acReport, strReport, acSaveNo
ReturnSQLReport = strTemp

' I put the following line at the end to try to figure out what
the error code means to no avail
Application.Acc essError (2486)

Looks like it's truly a Labor day :) Thanks.

And I'd like to tackle this one (this solution) first.


Why did you domment out the OpenReport?

If you open a report with acViewNormal, it will go to the printer.
YOu don't want that. That's why my original code used acViewDesign
instead.

Try running my code in its original form, but comment out the error
handler before you do. Change thies:

On Error GoTo errHandler

to this:

' On Error GoTo errHandler

Then run the code. If there's an error, the exact line that's
producing the error will be highlighted when you enter Debug mode.
Then come back and tell us what line produced the error and what the
error number and description were.

As long as you insist on altering the code I provided I'm not
interested in helping. The code I wrote works in my environment. I'm
only interested in helping you run it in your environment, and that
means figuring what's causing it to error out for you and not for
me. That means you have to start from my EXACT code.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #31
OK.

1. Let me explain, the following (prevously posted) code snip did not
convey what I was trying to say.
DoCmd.OpenRepor t strReport, acViewNormal
' try the following (not to include the acViewNormal arg)
' DoCmd.OpenRepor t strReport
strTemp = Reports(strRepo rt).RecordSourc *e
DoCmd.Close acReport, strReport, acSaveNo
ReturnSQLReport = strTemp

In actually, I tried the following code to no avail
DoCmd.OpenRepor t strReport
strTemp = Reports(strRepo rt).RecordSourc *e
DoCmd.Close acReport, strReport, acSaveNo
ReturnSQLReport = strTemp

2. I just tried your other solution (commenting out the error handler
on top as 'On Error GoTo errHandler),
created tblMyObjects table with (objectName, objectSQL and objectType
fields),
I tried to run the module, Run / Go or Continue, no error, however, no
data inserted into that table, then,
I tried, Ctrl-G, to bring up debug window, typed in
?PopulateMyObje cts() Enter, got compiling error,
then tried, varation of ?PopulateMyObje cts('reports'), not effective.

Thanks.

P.S. I swear I did not change your code, fyi, I'm using Access 97

?PopulateMyObje cts()

Nov 13 '05 #32
Please see post #31 (my reply followed yours, that is, 28, however, my
newest one showed up as 31), thanks. Maybe something more than weird
is happening ... thks

Nov 13 '05 #33
"NickName" <da****@rock.co m> wrote in
news:11******** *************@g 14g2000cwa.goog legroups.com:
Please see post #31 (my reply followed yours, that is, 28,
however, my newest one showed up as 31), thanks. Maybe something
more than weird is happening ... thks


These numbers are meaningless as posts are not numbered in my
newsreader, and since I'm not reading from the same newsserver as
you are, the order is unlikely be the same. Likewise, since I'm not
reading at exactly the same time as you are, even if I *were* using
the same newsserver I might be seeing a different set of messages,
since I may have different ones marked read/unread.

The only way to do this is to post a followup to the article that
your post is a followup to. Anything else is basically worthless.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #34
"NickName" <da****@rock.co m> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
OK.

1. Let me explain, the following (prevously posted) code snip did
not convey what I was trying to say.
DoCmd.OpenRepor t strReport, acViewNormal
' try the following (not to include the acViewNormal arg)
' DoCmd.OpenRepor t strReport
strTemp = Reports(strRepo rt).RecordSourc *e
DoCmd.Close acReport, strReport, acSaveNo
ReturnSQLReport = strTemp
Omitting the acViewNormal argument would have no effect, as the
default behavior is acViewNormal, which means to send it directly to
the printer. The correct argument is acViewPreview.
In actually, I tried the following code to no avail
DoCmd.OpenRepor t strReport
strTemp = Reports(strRepo rt).RecordSourc *e
DoCmd.Close acReport, strReport, acSaveNo
ReturnSQLReport = strTemp
That won't work -- you must use the acViewDesign argument for it to
work as a function.

But the function itself is of little use for your original purpose,
as it can't be called in a query.
2. I just tried your other solution (commenting out the error
handler on top as 'On Error GoTo errHandler),
created tblMyObjects table with (objectName, objectSQL and
objectType fields),
I tried to run the module, Run / Go or Continue, no error,
however, no data inserted into that table, then,
I tried, Ctrl-G, to bring up debug window, typed in
?PopulateMyObje cts() Enter, got compiling error,
then tried, varation of ?PopulateMyObje cts('reports'), not
effective.
Well, it's not a function -- it's a subroutine. So you call it in
the Debug window as:

PopulateMyObjec ts

and hi enter. No question mark (which is required for returning a
value from an expression) and no parens, which are for functions,
not for subroutines.
P.S. I swear I did not change your code, fyi, I'm using Access 97

?PopulateMyObje cts()


Get rid of the question mark and the trailing parens.

If that causes an error, then post the error number and the error
message and tell us which line of my code is highlighted in yellow.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #35
OK. I got the problem resolved. Thank you very much.

Nov 13 '05 #36

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2292
by: jb | last post by:
Using ADO.NET from ASP.NET. Have a SqlConnection executing stuff (stored procedures) I would like to be able to retrieve informational messages from the SQL sps, which comment on what they are doing (updating tables etc.), and show them to the user/write them to a file. Is there any way I can get at anything that comes from a SQL PRINT statement in this context? osql utility lets this go to standard output, which can be captured; that's...
1
294
by: Vik | last post by:
What is a method to create a datatable containing the properties of an SQL Server table? Thank you.
0
1442
by: Priya | last post by:
hi all, I need to read the xml schema file and retrieve the sql:datatype element value in the xsd file. The schema file format is below <xsd:sequence> <xsd:element name="safe_job" type = "xsd:string" sql:datatype="varchar(255)" /> </xsd:sequence>
5
1437
by: samadams_2006 | last post by:
Hello, How do I retrieve SQL Data into an XML Document? I have the following code, which will retrieve SQL data and write it to the screen via the Response Object, but I'd like to be able to read it as XML Data, and use XSL and XSLT to display the data. Any suggestions? Code Snippets MORE than appreciated... :) =================================================================
0
8787
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,...
1
9259
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,...
0
9208
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
8208
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
6750
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
6053
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
4569
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...
1
3279
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
3
2193
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.