How to make a table read-only in Access? - ms-access

I have made up Tracker form in Access 2013 in which end user update their daily routine tasks. I want to keep the table as read-only so that no one can make any unauthorized changes in the existing data.
Is there any way to do that in Access?

One solution would be to
move the reference table into a separate database file,
make that file read-only (e.g., by using Windows permissions on the file), and
use a Linked Table in the main database to access the reference table.

Use a query in place of the table, and change its Recordset Type property to Snapshot.
If you want to avoid users opening the table itself, move the table to another database and change the Source property of the table to the path of the other database. In SQL it gives something slike:
SELECT * FROM myTable IN 'f:\test\hidden.mdb'

AFAIK you cannot make a table read only, but you can do a number of things to lock down the database so that the user only has access to forms that are read only.
In Options deselect:
Use Access Special Keys
Display Navigation Pane
Allow Full menus
Allow Default Shortcut Menus
In the form, set the following properties to No:
Allow Additions
Allow Deletions
Allow edits

Related

Making Access database field structure changes propagate through to a Delphi app

I have a Delphi 2007 app that interacts with an Access 2000 database. I have made changes to the database structure (addition of fields) and need to make them visible in the Delphi application but that is proving difficult. I made a minimal Delphi application and Access database and the same issue is seen there.
My steps were:
create an Access database with Field 1 and Field2
use Settings/Control Panel/Administrative Tools/Data Sources (ODBC 32-bit) to create an alias to the MS database.
create a Delphi application.
add a TDBGrid to the form
add a TDataSource onto the form
set the Datasource property of the grid to DataSource1
add a TTable to the form
set the Dataset property of the TDataSource to Table1
set the DataBaseName property of Table1 to the alias name created for the database.
set the TableName property to the name of the table in your original Access database.
set the Active property of the Table to TRUE. All the fields originally defined in the database appear in the grid.
The problem is when I want to add fields later to this. I can make them appear as columns in the grid by rebuilding the whole thing from scratch, but there must be an easier way!
What is accepted best practice for forcing database structure changes through to the Delphi IDE and resulting application?
** Answer to Ken White's comment **
Thanks Ken. I appreciate the reasons for the Columns property of the DBGrid when you may not want all the fields in your grid - my issue is that when I use MS Access to add some fields to the table and then re-open my Delphi project:
if I disconnect the TTable and reconnect it, the FieldDefs property shows the added fields. All good.
I then move to the TDBGrid. The displayed columns don't show the additional fields, only the original ones. The Columns collection is empty.
when I inspect the Columns property and try to add all fields I just get the original fields. If I try to add one field` column, the picklist only gives me the original fields to choose from.
I don't understand why the TTable can see the new fields but the TDatasource (which has the TTable specified as it's Dataset property value) cannot.

Refresh Data in Access 2016 from Read-Only MySQL ODBC`

I am attempting to "sync" data from a read-only ODBC MySQL server to Access 2016. I need to move the data into Access so that I can more easily manipulate and create better customized reports.
I have linked the data tables between Access and MySQL, however I cannot get the data in these tables to automatically refresh. I must go into Access and hit "Refresh All".
What I'm looking to do is update all of my open tables in Access once nightly so that each morning the data used to build these reports is new. Currently if I leave these tables all evening, when I get in the next morning I must hit "Refresh-All" for Access to go retrieve the most recent data.
Any ideas?
The data in linked tables is automatically refreshed by access when you attempt to read them. You can do that by displaying a datasheet view of the database, or by a form where the linked table is the data source. Beware, we have had problems which tables with lots of records being the source for drop down lists, having the database locked.
Access only does this properly (and at speed) if either the underlying table has a unique clustered index, or after having linked the tables you create an index in access.
If you want to create a copy that you can manipulate (such as write to) and the underlying tables are read only, then you will have to create matching unlinked tables and execute some form of copy sql and appropriate points in your application.

How to run append query from data macro MS Access?

I have 2 table, one is local named 'Client' and other is a linked table to MySQL DB in my web-server named 'ClientSql'.
When I insert data into the table Client, I want it to be insert into clientSql too. I try it with data macro (after insert), but it shows me an error saying
It's not possible in linked tables.
I have tried to create an append query successfully, and it works, but it just works if I execute it manually. My question is:
Is it possible to call it from a data macro? if is possible, can you show me how? If not, can you point me to a solution?
I'm not sure why you should be able to do it manually, but not via a macro. According to this link
http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html
you should be able to do it either way.
Another thought is to eliminate the local access client table and have the access program update the mySql table directly. However, if another program is accessing the client table at the same time, this could become tricky due to multi-user and locking situations.

How can I lock a table in PHPMyAdmin so it can't be modified?

I'm trying to lock a certain table (called gmd_settings) so it can't be modified anymore, but my lack of experience with MySQL and PHPMyAdmin plagues me. I need it explained to me how I would do this in simple terms, to someone that doesn't manage MySQL databases for a living.
To accomplish this, you should set up proper permissions. MySQL allows you to set permissions not only on a database and table level, but also on individual columns. If you create a new user (or edit the user you're using for this project) and set the permissions you desire, you can limit the user's ability to edit the gmd_settings table. Make sure you don't lock yourself out and I suggest that you make sure you understand what's happening rather than just copying the steps I outline. With that being said, here's what I would do:
Click on the Users tab and the Edit Privileges for the user you wish to edit (or Add a new user).
Near the top, look for the second level of tabs where you can select "Database":
Then select your database from the list and click Go:
Next, from the second level of tabs again click on "Table"
Now you have to add permissions for each table. From the dropdown select each table in turn and grant the proper set of permissions. For gmd_settings, that might be only SELECT, for the rest you'll probably at least also need INSERT and UPDATE. Again, these will depend on your configuration and specific needs; you should have some understanding of what you're doing here.
Hopefully that will get you where you want to be.

Locking tables in Access 2010

How do I lock fields in access so the user is only able to add to table? I want the user to only have access to adding to the table to maintain data integrity.
Since you are using Access 2010 (or later) you can use event-driven Data Macros to restrict what the users can do. To prevent them from deleting records you can use the following Before Delete macro:
If you also want to prevent them from editing existing records you can use the following Before Change macro:
For more information see
Create a data macro