Solved

Make a field in a query locked

Posted on 2013-02-06
7
337 Views
Last Modified: 2013-02-07
I have a query that runs in datasheet view and the user can edit the data.  Is there a way to lock certain fields so they cannot be edited?  I'm using the datasheet view and not a form since it's more familiar to the user.

Also, in the query result, does the field properties follow the table it's based on. ie...if the table that the query is based on is a combo box, will the query also display this field as a combo box.  It seems to work in most situations but there is one field that does not follow this logic.
0
Comment
Question by:actolex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38862455
you can only lock certain fields using Form

you will set the form's control Locked property to Yes
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 38863023
> Is there a way to lock certain fields so they cannot be edited?

Yes, set the controls using the fields to locked.

> .. if the table that the query is based on is a combo box, will the query also
> display this field as a combo box

Yes, the query will inherit the settings from the table. However, if you later change the table, the changes will not be reflected in the query.
One option is to recreate the query; another is to make the changes manually in the query.

/gustav
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38864587
actolex :
<I'm using the datasheet view and not a form since it's more familiar to the user.>

capricorn1:
<you can only lock certain fields using Form
you will set the form's control Locked property to Yes >

To be clear, you can set the form's default view as "Datasheet"
Then in addition to setting the Locked property of your Control to Yes,
you can also set the enabled Property to No. (This will not even allow them to click into the control)

Sample attached (Note that the "Category" field is Locked (cannot be edited))
... and Disabled (you cannot even click in the control)

JeffCoachman
Database88.mdb
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:actolex
ID: 38864796
Thanks....I've done with in forms before but they will only show one record unlike the datasheet view.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 38864806
why don't you try using a datasheet form?



.
0
 
LVL 48

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 38865557
actolex,

Close your query (save it), then select it in the navigation pane.

Then go to the ribbon, select Create, then in the Forms area, expand More Forms, and select the Datasheet.  datashee formThis will create a datasheet form based on your query.  From there, you can select the control you want to lock and set it's "Locked" property to Yes.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38866660
;-)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question