Make VBA SQL into RWOP Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks for everyones help on the first question I had yesterday with RWOP
Queries and setting all my current ones to the right property through VBA
code. It worked great. The second question which I guess I didn't really
explain correctly was is there a way to make sql statements that are stored
in the code behind a form run with owners permissions. The reson is I have
several of these that will be difficult to convert to regular stored objects.

Example:

CurrentDb.Execute "INSERT INTO tblNew_Emp (FName,LName) Values (""" &
variable1 & """,""" & variable2 & """);"

This is just an example, some of the ones I have are very long and would be
difficult to remove from the code. I can't seem to find anything about this
issue and could use a little direction. Is it possible or do I need to start
removing all of these from my code.

Thanks for any assistance,
Jim
 
Hi James,

In case you haven't noticed, Tim Ferguson addressed this in your
previous thread. "Inline" SQL statements like these get the current
user's permissions. So the thing to do is to modify them so they are
based on RWOP queries rather than directly on the tables. So for your
example, you might use a RWOP query along the lines of
q_tblNew_Emp: SELECT * FROM tblNew_EMP WHERE FALSE
which would let the user append records but not view or edit them (or
instead of using WHERE FALSE, give the query an owner that has precisely
the permissions you need.
 
Back
Top