The function or code below creates a saved query used as the record
source for forms and reports. The funtions is called each time a user
clicks on a button to display a form or report.
This works just after security has been set for the user by cheching
all options, which include
delete, modify, append and administer. Security is being set on the
tables, queries and forms.
The second time the user clicks on the button that runs the function
the security check boxes become unchecked. The problems seems to be
that the security needs to be checked just before the code creates the
saved query: Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected",
SQL). How do set security in VBA code for query on object.
Dim SQL As String
Dim db As DAO.database
Dim qryCriteria As DAO.QueryDef
Dim ClearEndDate As String
On Error GoTo BuildSql_Err
'Select and From clause
SQL = "SELECT [Tbl-ContractInforma tion].*, WHERE "
'Build Reference Number Clause
If Not IsNull(Forms![frmSelectCriter ia]![cboReferenceNum b]) Then
SQL = SQL & "([Tbl-ContractInforma tion].[ReferenceNumb] = "
SQL = SQL & "Forms![frmSelectCriter ia]![cboReferenceNum b]) And
"
End If
'Build Reference Number Prefix Clause
If Not IsNull(Forms![frmSelectCriter ia]![cboReferencePre fixNumb])
Then
SQL = SQL & "(Left([ReferenceNumb],5) = "
SQL = SQL &
"Forms![frmSelectCriter ia]![cboReferencePre fixNumb]) And "
End If
SQL = SQL & " -1 = -1; "
Set db = DBEngine.Worksp aces(0).Databas es(0)
'Deletes the stored query def: qryCriteriaSele cted
DoCmd.DeleteObj ect acQuery, "qryCriteriaSel ected"
'Turn off Access system warning to create, delete or updates tables
DoCmd.SetWarnin gs False
'Create stored query def with return value deal criteria
Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected", SQL) 2 2405 to*******@msn.c om wrote: The function or code below creates a saved query used as the record source for forms and reports. The funtions is called each time a user clicks on a button to display a form or report. This works just after security has been set for the user by cheching all options, which include delete, modify, append and administer. Security is being set on the tables, queries and forms. The second time the user clicks on the button that runs the function the security check boxes become unchecked. The problems seems to be that the security needs to be checked just before the code creates the saved query: Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected", SQL). How do set security in VBA code for query on object.
Dim SQL As String Dim db As DAO.database Dim qryCriteria As DAO.QueryDef Dim ClearEndDate As String
On Error GoTo BuildSql_Err
'Select and From clause SQL = "SELECT [Tbl-ContractInforma tion].*, WHERE "
'Build Reference Number Clause If Not IsNull(Forms![frmSelectCriter ia]![cboReferenceNum b]) Then SQL = SQL & "([Tbl-ContractInforma tion].[ReferenceNumb] = " SQL = SQL & "Forms![frmSelectCriter ia]![cboReferenceNum b]) And " End If
'Build Reference Number Prefix Clause If Not IsNull(Forms![frmSelectCriter ia]![cboReferencePre fixNumb]) Then SQL = SQL & "(Left([ReferenceNumb],5) = " SQL = SQL & "Forms![frmSelectCriter ia]![cboReferencePre fixNumb]) And " End If
SQL = SQL & " -1 = -1; "
Set db = DBEngine.Worksp aces(0).Databas es(0)
'Deletes the stored query def: qryCriteriaSele cted DoCmd.DeleteObj ect acQuery, "qryCriteriaSel ected"
'Turn off Access system warning to create, delete or updates tables DoCmd.SetWarnin gs False
'Create stored query def with return value deal criteria Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected", SQL)
The second time you run it the query is created again, therefore any
security settings will be lost.??
--
regards,
Br@dley
Don't do it that way. Do this instead:
Set qryCriteria = db.QueryDefs("q ryCriteriaSelec ted")
qryCriteria.SQL = SQL
(david)
<to*******@msn. com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com... The function or code below creates a saved query used as the record source for forms and reports. The funtions is called each time a user clicks on a button to display a form or report. This works just after security has been set for the user by cheching all options, which include delete, modify, append and administer. Security is being set on the tables, queries and forms. The second time the user clicks on the button that runs the function the security check boxes become unchecked. The problems seems to be that the security needs to be checked just before the code creates the saved query: Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected", SQL). How do set security in VBA code for query on object.
Dim SQL As String Dim db As DAO.database Dim qryCriteria As DAO.QueryDef Dim ClearEndDate As String
On Error GoTo BuildSql_Err
'Select and From clause SQL = "SELECT [Tbl-ContractInforma tion].*, WHERE "
'Build Reference Number Clause If Not IsNull(Forms![frmSelectCriter ia]![cboReferenceNum b]) Then SQL = SQL & "([Tbl-ContractInforma tion].[ReferenceNumb] = " SQL = SQL & "Forms![frmSelectCriter ia]![cboReferenceNum b]) And " End If
'Build Reference Number Prefix Clause If Not IsNull(Forms![frmSelectCriter ia]![cboReferencePre fixNumb]) Then SQL = SQL & "(Left([ReferenceNumb],5) = " SQL = SQL & "Forms![frmSelectCriter ia]![cboReferencePre fixNumb]) And " End If
SQL = SQL & " -1 = -1; "
Set db = DBEngine.Worksp aces(0).Databas es(0)
'Deletes the stored query def: qryCriteriaSele cted DoCmd.DeleteObj ect acQuery, "qryCriteriaSel ected"
'Turn off Access system warning to create, delete or updates tables DoCmd.SetWarnin gs False
'Create stored query def with return value deal criteria Set qryCriteria = db.CreateQueryD ef("qryCriteria Selected", SQL) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Freeserve |
last post by:
Not sure whether this is the right group, but I can't find anything in the
..NET groups and my apologies if this has already been covered or is
considered "off subject".
I am looking at using an Access database to hold data which will be handled
via VB.NET and I am not sure about some of the security aspects. I am going
the .NET route as part of the application involves using a Pocket PC and I
don't want part to involve deploying...
|
by: Lyle Fairfield |
last post by:
There is an MS-SQL table named Bugs_Comments_and_Suggestions.
There is a form named Bugs_Comments_and_Suggestions.
To allow John Doe to use this form, we GRANT him LOGIN and ACCESS permissions
to the db and SELECT permissions on the stored procedure which is the record
source for the BOUND form.
To allow John Doe to "UPDATE, INSERT, DELETE" using the BOUND form, we GRANT
John Doe "UPDATE, INSERT, DELETE" permissions on the table,
|
by: Smriti Dev |
last post by:
Hi There,
I'm creating a MS ACCESS database using Ms Access 2000 to store
Interpretation requests by different departments in a hospital and
Interpreter availability. All internal departments will be calling in or
faxing their Interpretation requests to Intake staff at the Interpretation
department and the intake staff will feed the request into the database.
However, their is one department, Rehab, that is going to be going to be
able...
|
by: DFS |
last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security
in place, ODBC linked tables.
100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters
and ReadOnly. Each group sees a different set of menu options when they
open the client and login to Oracle.
For the sake of speed I use pass-through queries here and there for updates
and deletes. I update their SQL property in code and execute them.
|
by: sghi |
last post by:
Hi All,
I'm new to this group and quite new to access/vba.
So, shortly after beginning to write a simple application for my wife,
I came across a blocking problem: I need to intercept the sql statement
that stay behind a current, but not yet saved query.
When I work on saved queries I use:
strCurrentName = CurrentObjectName
Dim dbsCurrent As Database
Set dbsCurrent = CurrentDb
| |
by: Robert |
last post by:
How do you get an accurate count of the number of records returned from
a query when using linked tables.
I have an access 2003 database as a front end to another access 2003
database that contains only tables. I have linked the tables for the
front end to the back end database.
I am trying to set the recordsource of a form to a query established by
the user to narrow the scope but I don't want to display the form if
there are no...
|
by: Rob |
last post by:
Hi,
We have a MS Access front-end connecting to a SQL Server back-end. We
use an ODBC connection using NT authentication, however the audit
problem we have is that a user has the security to run stored procs
outside the app e.g. open a blank Access db, connect to SQL Server
using his NT account and create a query.
What we want to do is to have the app use 1 SQL Server login, not NT,
to connect to the app, however we want to encrypt...
|
by: Earl Anderson |
last post by:
First, I feel somewhat embarrassed and apologetic that this post is lengthy,
but in an effort to furnish sufficient information (as opposed to too little
information) to you, I wanted to supply all of the relevant facts. Second,
despite the fact that I think the obvious 'quick' answer to my question
would be 'Yes', I am seeking your wisdom and recommendation to the question
as to this particular set of circumstances.
I have 20 Security...
|
by: thebarefootnation |
last post by:
Hi,
I have created an access db that I would like to secure.
The database will exist on a shared drive and be used at a number of
different locations hence the reason to secure the database.
The users of the database also use other databases therefore I want to
secure this database without using the wizard so it does not effect
their other databases.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |