obyapka
05-23-2008, 04:20 AM
Hi,
I've made some mods to a database to drop and recreate some queries using QueryDefs.Delete and CreateQueryDef.
They work great for my security level - but not for any users that run this bit of code with a lower security privilege.
Its been a while since I've touched Access DAO so cannot remember if and how you can use a Workspace to utilise a higher privileged user/pwd to process this code.
eg Set ws = DBEngine.CreateWorkspace("MyWorkSpace", "username", "password")
Here is a code snippet:
strSQL = "SELECT * FROM qrySLA"
CurrentDb().QueryDefs.Delete "qrySLA"
If Forms!frmReports!txtMU <> "" Then
strSQL = strSQL & " WHERE " & txtMU.Value & ";"
Else
strSQL = strSQL & ";"
End If
CurrentDb().CreateQueryDef "qrySLA", strSQL
speedy advice would be appreciated
regards
Brian
I've made some mods to a database to drop and recreate some queries using QueryDefs.Delete and CreateQueryDef.
They work great for my security level - but not for any users that run this bit of code with a lower security privilege.
Its been a while since I've touched Access DAO so cannot remember if and how you can use a Workspace to utilise a higher privileged user/pwd to process this code.
eg Set ws = DBEngine.CreateWorkspace("MyWorkSpace", "username", "password")
Here is a code snippet:
strSQL = "SELECT * FROM qrySLA"
CurrentDb().QueryDefs.Delete "qrySLA"
If Forms!frmReports!txtMU <> "" Then
strSQL = strSQL & " WHERE " & txtMU.Value & ";"
Else
strSQL = strSQL & ";"
End If
CurrentDb().CreateQueryDef "qrySLA", strSQL
speedy advice would be appreciated
regards
Brian