Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

With Owneraccess Option Not Working In Code

Posted on 2002-06-07
5
Medium Priority
?
1,206 Views
Last Modified: 2007-12-19
i have a testuser that does not have permissions to edit tblMailMergePrintQueue.

i want the table to be appended though regardless of permissions and i want to do this through code, so i do this:
DoCmd.RunSQL ("INSERT INTO tblMailMergePrintQueue (QueueDate, QueuedBy, JobNum, MailMergeDocumentID)" & _
" SELECT Date() As QueueDate, CurrentUser() as QueuedBy, '" & Me.cboJobID.Column(1) & "' as JobNum, 37 as MailMergeDocumentID WITH OWNERACCESS OPTION;")

notice the "WITH OWNERACCESS OPTION".  when testuser tries to run this, he gets the much dreaded "Operation must use an updateable query" error.

if i move the exact SQL statement in a query object and then i call it through code like this:
DoCmd.OpenQuery "qappMailMergeDocumentID37"

everything works fine this way.

is there something i'm missing here?  does WITH OWNERACCESS OPTION not work in code?  i cant find any KB article on this.
0
Comment
Question by:davidsanderson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:blakeh1
ID: 7063379
I know that the WITH OWNERACCESS OPTION will not work when you use a SQL statement as the recordsource for a form or report instead of an existing query name. I suspect that through code it will not work either as it needs to get the permissions for that existing query object, whereas just a SQL statement really has no owner.
0
 

Author Comment

by:davidsanderson
ID: 7063384
can you think of any other way i could do it besides using a query object?
0
 
LVL 6

Expert Comment

by:blakeh1
ID: 7063388
Here is some info from microsoft

SQL statements used in a RunSQL macro or as the RowSource property for a control
are not real objects; instead, they are compiled and built when they are run.
Because they are not real objects in the Database window, they do not have an
owner, and the "Run With Owner's Permissions" property is ignored when they are
run. If you do not have permissions for the underlying table, you receive the
error message
0
 
LVL 6

Accepted Solution

by:
blakeh1 earned 200 total points
ID: 7063392
Unfortunatly I think that is what you will be stuck with, I can't think of anything off hand. Maybe someone else will have some ideas on a better way to do this
0
 

Author Comment

by:davidsanderson
ID: 7067188
i guess i'm stuck with it.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question