How to Disable Query Design view

B

Barmaley

I want to prevent users from opening MS Access Query in design view.

I got a feeling that this is something simple, but it just escapes me.

Artem

MS Access 2000 SP3
Windows 2000 SP4
 
G

Guest

Set 'Allow Design Changes' on the Other tab in the Properties window for the
form to 'Design View Only'.
 
T

TC

I'm not sure you /can/ stop a user from retrieving the design of a
query if he has permission to run that query. (Happy to be corrected on
that!)

You can certainly stop him /modifying/ the design - is that what you're
actually worried about?

HTH,
TC
 
B

Barmaley

Well,

I am exploring different possibilities.
Actually I wanted to prevent users to see the design because properties
contain User Name and password for connection (SPTQ)
Sinse so far it seems impossible, I am modifying my code to change my query
on the fly and delete info I don't want for users to see.

At the moment trying to find example of how to cycle through all my queries.

Thanks,

Artem
 
T

TC

(untested)

dim db as database, qd as querydef
set db = currentdb()
for each qd in db.querydefs
msgbox qd.name
next
set db = nothing

HTH,
TC
 
A

Arvin Rex

TC said:
(untested)

dim db as database, qd as querydef
set db = currentdb()
for each qd in db.querydefs
msgbox qd.name
next
set db = nothing

HTH,
TC
THIS WILL DELETE YOUR QUERY!!! Not hide it
adrian
 
T

TC

What on earth are you talking about?

The code I posted will enumerate the queries in the current database,
and display their names in message boxes.

It will not delete anything - under any circumstances.

Please retract your incorrect comment.

TC
 
T

TC

I am off for the day.

I expect you to retract your incorrect comment, per my other reply,
before I return in 24 hours.

TC
 
B

Barmaley

Thank you TC.

I already found one way of doing it and you provided different way.
I tested your code - it works.
I have no idea why Arvin thinks that your code will delete all queries
(maybe Set db = Nothing statement ????).

Here code snippets - both result in same thing:

Thanks again


Sub step_through_All_queries_1()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllQueries collection.
For Each obj In dbs.AllQueries
'If obj.IsLoaded = True Then
' Print name of obj.
Debug.Print obj.Name
'End If
Next obj
End Sub

Sub step_through_all_queries_2()
Dim db As Database, qd As QueryDef
Set db = CurrentDb()
For Each qd In db.QueryDefs
Debug.Print qd.Name
Next
Set db = Nothing
End Sub
 
T

TC

Barmaley said:
Thank you TC.

I already found one way of doing it and you provided different way.
I tested your code - it works.

No probs, glad it helped.

I have no idea why Arvin thinks that your code will delete all queries
(maybe Set db = Nothing statement ????).

He's an idiot. I emailed him to post a retraction but he is too stupid
to do so.

Cheers,
TC
 
T

TC

Oops, he has emailed me:

"message was erased when no one else saw it after you did. Sorry about
that!"

No so easy to erase newsgroup messages, though!

TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top