Link to home
Start Free TrialLog in
Avatar of __Holly__
__Holly__

asked on

lock docmd.Runsql

id like to make it so that docmd.Runsql cant execute

technically, it is for an Access Data Project, and im trapping for certain SQL Statements that can't be run.

Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

An example being ?
Avatar of __Holly__
__Holly__

ASKER

uh. i want to trap sql statements.

i do a LOT of conversion from MDB->ADP

i want to be able to lock down a sql statement until its been approved.

so i want to replace the RunSql funciton-- like you can do in word VBA.

in other words-- within Access vba--

if i paste a new function inside my project for 'replace' then it will use that function instead of the built in function.

id just like to be able to replace/encapsultate the runSql statement such that whenever vba tries to Docmd.Runsql it goes to my RunSQL sub in order for logging/validation; etc.

my main goals are this:
1. log all sql statements fired to the db.
2. have a custom proc that will allow me to validate sql statements (so that once i go into production, i can block all attempted TRUNCATE statements for example)
3. make this such that i can send a different developer this project, and he doesnt know that anything is up-- he just has to type Docmd.RunSQL and my new function will be inherited.

Like-- in word--

if you dont like the print functionality, you can make a new print sub/function and whenever someone pushes the print button it will call your code.

i just want to know how to do the same thing within the Access object model.

there HAS to be SOME way to do this.
The RunSQL method is a method of the DoCmd object - it is not a function, so cannot simply be replaced by placing a function with the same name in the application. It may be possible to add a method or replace existing methods of the built-in DoCmd object, but how you do that is beyond my knowledge.
__Holly__


I restrict all access to tables, the only modification allowed is by executing sprocs. I have a standard Insert, Update, Delete, View Stored procedure for each table.
Under these conditions runsql fails.

Alan
i think that was i was looking for was close to noexec, but this wont really work either.

shane hit the nail on the head when he said 'it may be possible to replace existing methods'

because thats all that we do within winword that is so cool..

i just wish that someone knew how to do this.

perhaps i should look at maknig the ADP connection properties readonly or something and then have a seperate connection the only runs updates.

i dunno.
ill keep on looking.
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i gotta give this a little more time.

this really really rock my world, in order to be able to call some API Call that would even just DISABLE a certain function.

if i could shut off entirely docmd.runsql, and then have my wrapper function (runsql) so this, that would rock.

maybe i could just try to lock down ALL updates, inserts, etc-- and then just give everyone the ability to run a sp named RunSql that would then do everything that i needed.



Good plan