I have ms access file of mdb format. I want audit trail enabled on one table. For every change I need to modified row details in audit trail table.
Here issue is, table doesnt use forms to update/insert/delete and it has composite primary key. We can enable audit trail if we use .accdb format(2010 access-by enabling Data Macros).
But I don't want to change existing file format. Is there a way to do this? Please suggest.
No, you cannot do what you describe using Access alone.
If you are adamant about keeping the .mdb file format then you cannot use Data Macros so the only way you could write to the audit table would be through VBA code behind forms. Any changes made directly to the data table would not be audited.
If you converted the back-end database to an Access 2010 .accdb then you could use Data Macros to update the audit table, but the audit table would not be secure. Users would need write access to the audit table so the Data Macro could update it. However, if they can write to the audit table indirectly via the Data Macro they can also write to the audit table directly. A malicious user could circumvent the audit by simply altering the audit table after updating the data table. (And, by logical extension, there is no way to audit changes to the audit table.)
One conceivable workaround would be to keep the data table in Access 2010 and put the audit table in a truly secure location like a SQL Server database. Unfortunately, that won't work because Data Macros cannot update linked tables.
So, in order to have a reliable and meaningful audit feature you will have to move your data tables to a secure back-end like SQL Server (or perhaps MySQL, or any number of other options), set the appropriate permissions on the data and audit tables, and use a mechanism like triggers to maintain the audit table. You could continue to use Access as the front-end interface (via ODBC linked tables to the back-end database) but the security and auditing functions would have to be handled by the back-end, not by Access.
Related
I am aware of MS Access - link to query in another Access database from a number to years back. My need is not so simple.
We have a number of MS Access ACCDBs which use linked tables to perform certain activities on linked tables (in both SQL Server DBs and local MDBs/ACCDBs). They consist of a very large number of queries and macros etc.
Each ACCDB references the main database using the linked tables and we have a small number of such databases with different content but identical structure. In the past, we have used some VBA code to re-link the main database. But the content is now significantly different in the main databases that we'd like to create a separate ACCDB for each content type. Naturally, because they are dealing with identical structures, a significant (>75%) portion of the objects (queries, macros, tables etc.) are notionally identical. Is there any way to create a "container" for the common stuff - similar to an ACCDE to hold the common stuff and reduce the maintenance burden as the common stuff "evolves" in one ACCDB (and needs to be distributed to the other ACCDB)?
We use the full range of Access objects - including all "action" query types, macros, linked tables etc.
The referenced link only allows selection queries. It doesn't seem as though "action" queries and macros can use the same kind of syntax to access the items in the external DB.
TIA,
Paolo
[Edit: To be clear, I need to run the stuff in the "library" DB in the context of the main ACCDB. Thus if I have a query "Select * from myTable" stored in the Library DB when I run it, it needs to reference the myTable in the ACCDB not the one in the library (if I even need one there)]
You can add a reference to a "library" database, and that will give you direct access to the code in that database.
To access queries, you can open the external database, but queries will run in their external context, not in the current (local) database. However, the tables you have linked in the current database can be linked as well in the external database. This way it doesn't matter where the query runs.
If I have a tool that writes data to Access but one of the tables is a linked table, how exactly is the data written to that linked table? Does the data get off-handed to Access and then within Access, Access handles the writing of the data? Or is a kind of link provided to the tool and then the tool writes directly to the table?
The reason for asking is that I've encountered times where some automated tools that I work with will or won't write to a linked table and I'm curious of how to ensure that data is always written.
Usually, all data is written via the Access Database Engine, unless you're doing something weird.
In most situations, it works like this:
Tool submits a query via OLEDB/ODBC/DAO to the Access Database Engine (DAO360.DLL/ACEDAO.DLL)
Access Database Engine determines which data should be read/written to where (to the file/remote data source)
Access Database Engine uses the connect property of the linked table to try and open a connection if necessary, and creates a new query or multiple queries in the appropriate SQL dialect
Access Database Engine submits query/queries via the opened connection
However, this can go wrong:
The tool doesn't actually use the Access Database Engine at all, but tries to directly write the file (via UCanAccess/MDBTools/proprietary driver), and those don't support linked connections at all
The connection string in the linked table requires an ODBC driver, password, resource, or something else that's not present or not in the right place
The linked table requires some sort of implicit authentication (e.g. SharePoint), and this doesn't happen
The data source used by the linked table requires a specific lock type (e.g. dbSeeChanges for opening a Dynaset-type recordset on SQL server) which is not used by the tool
And of course, many, many more things can go wrong (in fact, I crashed Excel in an attempt to test reading a linked SharePoint lists while writing this answer).
I've just been assigned the task to create another Access DB whose data is a subset of the master DB. I didn't build the original DB and I'm just stuck in trying to create this functionality.
Depending on a Boolean value (which I will have to integrate into the DB) each entry will dictate if all the entries data will be shared or if only a portion of the data will be shared. By sharing I mean transferring the entries into a mirror DB that is located in a folder that a wider group of people has access to.
I don't know how to even start but I'm guessing that the relations structure that the person who built the DB will be helpful for when I erased an entire entry in the DB it erased all data in other tables related to my entry as well.
For added "fun" I'm suppose to manage a C.R.U.D. system for this subset in case either a person accidentally clicks on the share button (Create) and wants to unshared the data (Delete) or when part of the original gets updated and the mirror then needs to get updated as well (Updated).
I'm hoping to get a few good ideas as to how to proceed.
Limitations and Info that I see might be relevant.
-The original DB is located in a folder whose permissions are restricted to people entering data.
-Can't use third party applications that require an install.
-The mirror DB does not have to updated automatically when the master DB updates. It can be restricted to when a user clicks a button called "Updated Mirror DB". (Only if this would provide a simpler solution)
-The process can be as slow as molasses in winter as long as it is robust.
-I have decent VBA skills when it comes to working in Excel but it lacks when related to Access.
-Users who create and manage the data have read and write access to both the folder that the master DB is in and as well the mirror DB.
-Using Access 2007 - 2010
Thanks everyone for take a look at this. If you would require more info to provide assistance please just ask and I'll do my best to acquire it.
Seeing as you have decent vba, and you're limited to apps which don't require an install, I suggest you do it as an excel vba app. VBA has all the functionality you'll need to copy databases from one spot to another on the file system, compact and repair (adox), drop tables you don't need, insert/update/delete etc.
Depending on which info you need to persist to the mirror db, it may be easier to simply make a copy of the master db and delete irrelevant tables (if it's only certain tables you need to mirror). If it's a subset of data in each table, you may find the best way would be to make a template db, which is a copy of the master db but with no data, then create a vba process to copy the template db, create linked tables in this one back to the master, then run sql to insert into the local tables select (whatever data you need to mirror) from the master tables.
All of this can be done in vba, and your users end up with an excel interface which will be very familiar. Good luck.
Ques: I have two database one is client's database(live database) and another is mine.I am using MySQL database. I should not access client's database directly so I created my own database. By using 'Talend' data warehousing tool I created job for each table and by executing all jobs I can get all updated data from client's database(live database) to my database. I need to execute these jobs manually for getting updated data into my Database, But my question is: is there any process which will automatically remind me, when client insert or update data on there data base so I can execute those jobs manually to get updated data into my database ?? or if client update their any database table so automatically associated job will Execute/Run ?? Please help me on this.
You would need to set up a database trigger that somehow notifies the Talend job and runs it. To do this you'd typically call the job as a web service using a stored procedure or user defined function. This link shows a typical way that a web service may be called on an update trigger for example.
If your source data tables are large, rather than extracting all of the data from the table and then I guess dropping your table and recreating you could use a tMysqlCDC component to only affect changes. The built in tutorial for the component looks like it pretty much covers a useful example of this in practice. If you are seeing regular changes in the source database this could make your job much more performant.
If you have absolutely no access to your client's database then you could alternatively just run the job with some scheduler. The Enterprise versions of Talend come with the Talend Administration Console that allows you to set CRON triggers for a job and could easily be set to run every minute or any other interval (not seconds). Alternatively you could use your operating systems scheduling system to run the job at your desired intervals.
If you can't modify your clients database (i.e. add triggers), and there is no other way to identify changed records (i.e. some kind of audit table) then you're our of luck.
i have 2 questions when i use access:
i create a form with comboBox and calenders, i want to choose an employee
from combobox and from date and to date and when i click ok i will send these
parameters to a query to return the result in a query (result is the calculation
of it's salary).
i know how to release an access project to be useful to user that can't
access tables and queries only forms.
is there any way to change the access project from release mode to development
one, because supposed that an error occurred, how to solve it without loosing
my data.
Note: i don't have client/server i develop a program and i release it and
give this release to the user, after a specific time this user tell me that
an error occurred, and he need data inserted from this program to database.
i can solve this problems and release another version of program, but the
main problem is how to take all data from the old program to the new one.
-- You can reference form control in a query:
SELECT FROM MyTable
WHERE EmployeeID = Forms!MyForm!cboEmployee
AND SomeDate BETWEEN Forms!MyForm!txtDateStart And Forms!MyForm!txtDateEnd
You could also build an SQL string and use it as the record source for a form or in VBA.
-- Access should be split into front-end (forms, reports, etc) and back-end (data). When you make changes to the front-end, you create a new mde or accde and send that to the users. The data stays on a server in the back-end.
See: http://msdn.microsoft.com/en-us/library/aa167840(v=office.11).aspx
EDIT
From your comments, it seems that each application has a single user, if this is the case, splitting is not essential, but it can still be a good idea. The user will get two databases, one for data and one for forms etc and only the one for forms gets replaced. You will need to include a routine to locate and link the back-end tables.
However, if this is not possible, an mde or accde does not hide the data, you can send your revised copy and include a routine to import from the previous mde/accde.
EDIT 2
There are wizards that will split your database for you and link the tables. Where you find them varies slightly from version to version, but they are under the menu item Database Tools. The only problem with this is that the linked table holds the location for the back-end, which is on your computer, not on your users computer. Linked tables are how you access data in the second database. These act as if there are tables in the first database, except you cannot change them. Unfortunately, linked tables hold the location of the back-end, so this will have to be changed if you are sending it to a users. You can either write code, or show your user how to use the linked table manager. This may lead to confusion and may not be worth the effort for one PC. (See also http://www.alvechurchdata.co.uk/accsplit.htm)
Alternatively, you can split the database on your PC and make all the changes to forms etc that you want, then add some code that will import the tables and other data for the user into your new copy. The user will follow the instructions in your code to import the tables. As an aside, you will find that development is a lot safer on a split database. You should also decompile from time to time, which you can find at http://www.granite.ab.ca/access/decompile.htm.
If you want to protect your code, you can create a compiled version of this new copy, the extension for a compiled Access database is *.accde, for 2007 onward and *.mde for prior versions. This is what I thought you meant by 'i know how to release an access project'.