473,382 Members | 1,775 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,382 software developers and data experts.

Invisible Query Head-Scratcher


As part of my ongoing efforts to tidy up an old database by weeding out
old unused stuff, I exported all the query data by looping through
querydefs like so:

For Each qry In db.QueryDefs
'get qry.Name
'get qry.SQL
loop

This gave me the usual list of ~sq_* and user defined queries. Fine so
far.

I then proceeded to attempt to delete queries that I identified as
being unused, only to find that they were not there! Despite the fact
that I obtained the name and full SQL for these queries from the
QueryDefs they do not appear in the database window. Neither do they
make any appearance whatsoever in the MSysObjects table. They simply
dont exist!!

How are these "ghosts of queries long gone" in the database, and how do
I vanquish them?

I don't want to import objects into a new database, I'm more curious to
get to the bottom of this! And the first person to say compile or
decompile will get an e-slap (neither gets rid of them)!

Nov 13 '05 #1
14 2272
On 8 Sep 2005 06:02:10 -0700, "BillCo" <co**********@gmail.com> wrote:

Why do you think they are invisible and hard to handle?
Right.
So leave them alone.

-Tom.


As part of my ongoing efforts to tidy up an old database by weeding out
old unused stuff, I exported all the query data by looping through
querydefs like so:

For Each qry In db.QueryDefs
'get qry.Name
'get qry.SQL
loop

This gave me the usual list of ~sq_* and user defined queries. Fine so
far.

I then proceeded to attempt to delete queries that I identified as
being unused, only to find that they were not there! Despite the fact
that I obtained the name and full SQL for these queries from the
QueryDefs they do not appear in the database window. Neither do they
make any appearance whatsoever in the MSysObjects table. They simply
dont exist!!

How are these "ghosts of queries long gone" in the database, and how do
I vanquish them?

I don't want to import objects into a new database, I'm more curious to
get to the bottom of this! And the first person to say compile or
decompile will get an e-slap (neither gets rid of them)!


Nov 13 '05 #2
Thanks Tom, very helpful!

Nov 13 '05 #3
They are invisible because they don't show up in the database window or
in the MSysObjects window. I never said they were "hard to handle".

The reason I don't want to leave them alone is that
1. They are there, and yet not there... wouldnt you be even a little
curious?
2. I've declaired war on bloat
3. I want to learn all about access, which means finding out where
these little blighters escaped the deletion net and how to finish the
job of removing them.

Anyone have any ideas?

Nov 13 '05 #4
On 8 Sep 2005 06:22:04 -0700, "BillCo" <co**********@gmail.com> wrote:

You tied one hand on your back. One of the VERY few options to remove
them you don't want to hear about.

-Tom.

They are invisible because they don't show up in the database window or
in the MSysObjects window. I never said they were "hard to handle".

The reason I don't want to leave them alone is that
1. They are there, and yet not there... wouldnt you be even a little
curious?
2. I've declaired war on bloat
3. I want to learn all about access, which means finding out where
these little blighters escaped the deletion net and how to finish the
job of removing them.

Anyone have any ideas?


Nov 13 '05 #5
BillCo wrote:

I then proceeded to attempt to delete queries that I identified as
being unused, only to find that they were not there! Despite the fact
that I obtained the name and full SQL for these queries from the
QueryDefs they do not appear in the database window. Neither do they
make any appearance whatsoever in the MSysObjects table. They simply
dont exist!!

How are these "ghosts of queries long gone" in the database, and how do
I vanquish them?

I don't want to import objects into a new database, I'm more curious to
get to the bottom of this! And the first person to say compile or
decompile will get an e-slap (neither gets rid of them)!


Have you tried turning your options to view hidden objects? <Now, don't
hit me!>

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #6
lol, I guess so!

They're gone now anyway... wherever they came from. Very strange, there
were 6 pages worth of query names, most of which were removed from the
database literally years ago - complete with spelling errors. I dont
know what brought them kinda half back to life ( I wonder if it had
anything to do with the decompile I ran a few days ago....), or why a
compact got rid of them now, when I compact this test db three or four
times a day anyway? I'll have to see if I can re-create this.

So in the mean time I guess the e-slap goes to me - *twack*!

Nov 13 '05 #7

Yeah, I tried hidden objects, MSys tables etc. The only place they
existed was in the QueryDefs...
I don't want to import objects into a new database, I'm more curious to
get to the bottom of this! And the first person to say compile or
decompile will get an e-slap (neither gets rid of them)!


Let me re-phrase that, <i> neither GOT rid of them in the past!</i> but
today out of the blue... I dunno - if i didnt still have the word
document with lists of long dead queries I'd be questioning my sanity.

Nov 13 '05 #8
On 8 Sep 2005 06:02:10 -0700, "BillCo" <co**********@gmail.com> wrote:

As part of my ongoing efforts to tidy up an old database by weeding out
old unused stuff, I exported all the query data by looping through
querydefs like so:

For Each qry In db.QueryDefs
'get qry.Name
'get qry.SQL
loop

This gave me the usual list of ~sq_* and user defined queries. Fine so
far.

I then proceeded to attempt to delete queries that I identified as
being unused, only to find that they were not there! Despite the fact
that I obtained the name and full SQL for these queries from the
QueryDefs they do not appear in the database window. Neither do they
make any appearance whatsoever in the MSysObjects table. They simply
dont exist!!

How are these "ghosts of queries long gone" in the database, and how do
I vanquish them?

I don't want to import objects into a new database, I'm more curious to
get to the bottom of this! And the first person to say compile or
decompile will get an e-slap (neither gets rid of them)!


Hi
~ objects are things that have been deleted. Compact will get rid of them.

There is often a lot of crud in an old database, best removed by importing everything
into a new one though this needs care if the db is secured.

Nov 13 '05 #9
BillCo wrote:
Let me re-phrase that, <i> neither GOT rid of them in the past!</i> but
today out of the blue... I dunno - if i didnt still have the word
document with lists of long dead queries I'd be questioning my sanity.


Let's open an X-File on it... (note smily) 8) 8)

Seriously, I seem to recall seeing posts over the years here on similar
issues, ghosts of long dead objects and so on. Don't think I've
encountered it myself, but I'm still waiting for the aliens to swoop
down and show me clones of Jesus and Mohammed...

8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #10
Am I right that if you have say a form, with a combo-box that has query
as a recordsource, wouldn't that show up as a querydef?
I did something similar to you and I had a load of these and if I
recollect, they were asscoiated with combo-boxes I had on a form!

I could be wrong, others may want to chime in and verify this though!

Nov 13 '05 #11
Bob
Try this in a new module:
'*********** code **********

Public Sub QFix()
Dim db As Database

Set db = CurrentDb
db.QueryDefs.Refresh
Set db = Nothing
Debug.Print "All done"

End Sub
'*********** end code **********
Call from debug window with
QFix

Bob

Nov 13 '05 #12
indeed they do - they show up with names such as ~sq_frmMyForm_Combo1

The case here was different though, the queries were old user-saved
queries - that for some reason chose to re-appear in the querydefs and
vanished again on compact

Nov 13 '05 #13
Thanks Bob, that's handy to know!

Nov 13 '05 #14
BillCo wrote:
indeed they do - they show up with names such as ~sq_frmMyForm_Combo1

The case here was different though, the queries were old user-saved
queries - that for some reason chose to re-appear in the querydefs and
vanished again on compact

I think the ~queries are compiled queries in Access...hidden because
they are system files. A compact should get rid of them if deleting the
one you view in the database window doesn't get rid of it. Ex:
Test
~test
Delete Test,, ~test is removed.

When looping throught queries you might save yourself grief by entering
If left(qdf.Name,1) <> "~" then
and when looping through tables
If left(tdf.Name,4) <> "Msys" then
Nov 13 '05 #15

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

Similar topics

6
by: Matt | last post by:
Is it possible to post form data and open an invisible window? For example, in page1.as <form action="page2.asp" method="POST" It will post the form data from page1.asp to the server, and...
11
by: Saqib Ali | last post by:
Please excuse me, this is a fairly involved question that will likely require you to save the file below to a file and open it in a browser. I use Mozilla 1.5, so the problem I describe below...
4
by: Andy Fish | last post by:
Hi I have hunted around for this one but been unable to find any definitive answer. I have a simple frameset with one frame above another. by clicking a checkbox or some such in the lower...
1
by: Tor Inge Rislaa | last post by:
Invisible ASP.NET action I have an .aspx page with some controls and a SEND button that are sending an e-mail based on the content in some textbox's. Is it possible to call the page with some...
16
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
2
by: Arnaud Diederen | last post by:
Hello, I cannot succeed in getting any key event on a div that's been set invisible by the style's MozOpacity property under firefox. I'm using this method so that I can capture the mouse...
69
by: kabradley | last post by:
Alrighty Guys and Gals, I have another question that I hope you all can help me with. I have a report that uses a cross-tab query as its record source. This cross-tab query is getting all of its...
5
by: my.shabby.sheep | last post by:
Hi, I want to do the following. I want to make a table column invisible to the screen, but I still want to be able to get the innertext that would have been stored in the cell for certain...
4
by: zhshqzyc | last post by:
Hi, I am using the paging skills for my page. I'm doing manual databinding (that is, setting the DataSource property, and then calling DataBind()) instead of automatic databinding. So I manually...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.