473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with user permissions

I have a form that allows users to select criteria for a report. One of
the controls on the form is a multi-select list box. Using the MS
Knowledge Base, I wrote my code to pull the items from the list and
make a querydef for the report. Everything runs great for me but if I
log on as one of my users, I get the "You do not have the necessary
permissions to use the "myquery" object" error. I have given the users
modify permission on this query. The saved query is a RWOP query. I
even tried giving the users administer permissions on the query and it
still will not run. Can anyone tell me what I am doing wrong?

After building the SQL string I run the following:

Set DB = CurrentDb()
Set Q = DB.QueryDefs("m yquery")
Q.SQL = strSQL
Q.Close
Set Q = Nothing
Set DB = Nothing

DoCmd.OpenRepor t "myreport", acViewPreview

Nov 13 '05 #1
5 1328
karinski wrote:
I have a form that allows users to select criteria for a report. One of
the controls on the form is a multi-select list box. Using the MS
Knowledge Base, I wrote my code to pull the items from the list and
make a querydef for the report. Everything runs great for me but if I
log on as one of my users, I get the "You do not have the necessary
permissions to use the "myquery" object" error. I have given the users
modify permission on this query. The saved query is a RWOP query. I
even tried giving the users administer permissions on the query and it
still will not run. Can anyone tell me what I am doing wrong?

After building the SQL string I run the following:

Set DB = CurrentDb()
Set Q = DB.QueryDefs("m yquery")
Q.SQL = strSQL
Q.Close
Set Q = Nothing
Set DB = Nothing

DoCmd.OpenRepor t "myreport", acViewPreview


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Instead of changing the query you could use the Report's Filter property
to get the records you want. Use the report's On Open evetn. E.g.:

' get the selected items from the list box
strListBoxItems = getSelectedList Items(Me!MyList Box)

' filter on the selected items
Me.Filter = "column_nam e In (" & strListBoxItems & ")"
Me.FilterOn = True

' continue w/ the report
...

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQherPIechKq OuFEgEQKTmQCgqq yuCeBZoiKzXWge8 Ma63O+OplcAniWY
j8FpaXQMHokywr+ frcSlHCo+
=Z6Sq
-----END PGP SIGNATURE-----
Nov 13 '05 #2
Thanks for getting back so quickly. Your solution would work for me but
the report has a sub report that runs indirectly to the same query. The
report and sub report are NOT linked. The sub report does a "group by"
record count on one of the report's fields. I didn't use the group by
header/footer in the report because I wanted to show all the counts
together at the end of the report. In other words "5/28/05 = 5 items
6/10/05 = 2 items 7/20/05 = 3 items". When I tried to update the
sub report's filter in code I got a cannot change record source after
the report is open error.

Nov 13 '05 #3
Hi
After building the SQL string I run the following:

Set DB = CurrentDb()
Set Q = DB.QueryDefs("m yquery")
Q.SQL = strSQL


I don't understand why you're using an existing query and then setting the
query's SQL property. If you're going to do this, you might as well create
a temporary QueryDef.

Set Q = DB.CreateQueryD ef("")
Q.SQL = strSQL

Try it - you'll like it!
Nov 13 '05 #4
I now see that I misread your post, and didn't realise you were using this
query as the datasource for a report. That complicates matters.

Have you tried adding WITH OWNERACCESS OPTION to the end of your query?

I must confess I've often had problems with Access's security model and
found things didn't seem to work as they should. Sometimes you find that
creating a new database and copying and pasting the objects into it solves
the problem.

If all else fails you could try:

creating a new querydef (with the appropriate name)
adding it to the querydefs collection
opening the report
deleting the querydef in the report's OnClose event

At what point do you get the error message? When you try to open the report
or sooner?

Nov 13 '05 #5
Hey Captain Nemo,

The last part of your message did the trick!

creating a new querydef (with the appropriate name)
adding it to the querydefs collection
opening the report
deleting the querydef in the report's OnClose event

At first I couldn't understand why the user could delete the query
when they couldn't even modify it before, but I guess because it is
created after they have logged in, they are the "owner" of the query.

Works like a charm now! I wish I had posted sooner. I was afraid I
would get told to "read the help files".

Thanks everyone.

Nov 13 '05 #6

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

Similar topics

1
5425
by: Micah Gentry | last post by:
Is there any way to allow a user to use the xp_cmdshell extended stored procedure without giving that user execute permissions to xp_cmdshell in SQL server 6.5? Let me clarify. Lets say I (as the dbo) create a stored procedure called sp_send_err: CREATE PROCEDURE sp_send_err @CompID varchar(20) AS declare @strCMD varchar(255) select @strCMD = "master.dbo.xp_cmdshell 'net send " + @CompID + " ""ERROR!""', no_output" execute (@strCMD)
2
4296
by: J.Beaulieu | last post by:
Hi I'll have probably to use sql server soon but prior to that I have a question concerning priviledges and security. Is it possible for someone to do like in access, ie creating a db/table that is locked with a password? My guess is that it will be yes but in cas of... Now is it possible for someone to make a db/table read only rather than to lock it totally? Also can the guy who has an administrator priviledge on the server determine...
3
4465
by: teddysnips | last post by:
Currently studying for 70-229. I'm trying to understand how security for users is managed in SQL Server. I've been using SQL Server for a few years now, but without investigating the bits that "just work". So, here's the scenario. This is more or less how I create all my applications (which these days are all ASP.NET). I have a database called "TESTDB" (original, huh?)
5
3148
by: Kissi Asiedu | last post by:
I have access 97 database being run by multiple users. It was working fine until I created a form and a macro to open the form at start-up. Now only one user can open the table. If a second user attempt to open the same table at the same time, there is an error message that says "table cannot be lock, it is being used by user A on machine C or you may not have permmision to open table". Does anyone have an idea how to solve this problem? I...
10
1772
by: Jayme Pechan | last post by:
I wrote a very simply web application and I'm having all sorts of problems with the security getting in the way. All the web application does is load an out-of-process COM server that is running as a service. The code is here written for both a WinForm C# application (which works correctly) and a Web application (which does not work correctly): // C# application xtapisvrLib.XtapiConfig x = new xtapisvrLib.XtapiConfigClass(); ...
0
1299
by: Henrik_the_boss | last post by:
Hello all. I have a couple of aspx pages. When something fails in them, I would like them to be able to log to either a database, a logfile, or the application log. All code is in C# I run into permissions problems straigh away though. To log to the event log, you need Administrator privileges. So followed MS example how to sandbox sensitive and secure code.
0
1196
by: hagaiy | last post by:
Has anyone else come across this? We are building an ASP.Net application that uses a certificate and private key in the local machine store. (we are testing it both on windows 2000 & 2003) We failed accessing the private key of the certificate and as we tried to figure out what is the problem we came across the following Microsoft Article: http://support.microsoft.com/d­efault.aspx?scid=kb;en-us;3275­87
16
2305
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio, but cannot connect through code. I have done it before and can not do it now; I don't know what changed. (I also cannot connect to local Access database through code though I can from server explorer.) The code is: conn = New SqlConnection("data...
15
4596
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
9
5241
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in ADSearch.FindAll()) { //ActiveDs.ADSearchres.Properties
0
8384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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
8718
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
8499
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
8601
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
7314
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...
0
4150
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
2726
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
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.