Solved

Add - Modify Data

Posted on 2011-03-09
9
218 Views
Last Modified: 2012-05-11
Hi,

General high level question. (Must have arisen before).

I have simple table for "Supplier Details".
The data is UniqueSupplierCode, Name, Address, Email etc.

I want a SINGLE form which will allow me to Add new suppliers and modify existing ones.
How can I prevent the user from amending the UniqueSupplierCode once it has been set up.
They can obviously amend the name and address details etc.

I do not want to use autonumbering.

0
Comment
Question by:Patrick O'Dea
  • 5
  • 3
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35087516
lock the control that display the UniqueSupplierCode
0
 

Author Comment

by:Patrick O'Dea
ID: 35087652
Thanks capricorn1,

But if I lock the control then I will not be able to add NEW suppliers ??  true?
0
 
LVL 84
ID: 35088414
You can toggle the control to allow edits based on the NewRecord value. You'd do this in the Current event of the form:

Sub Form_Current()
  Me.YourControl.Enabled = Me.NewRecord
  Me.YourControl.Locked = Not Me.NewRecord
End Sub

This will Enable and Unlock your control when the form is in the "NewRecord" mode only.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:Patrick O'Dea
ID: 35088777
THanks LSM,


a perfect solution!
0
 

Author Comment

by:Patrick O'Dea
ID: 35088945
oops, I thought I had closed this query and have since raise another query that relates to this one.

...The solution is not as perfect as I thought !

I need to be able to filter and sort on the data that is disable by this code;

 Me.YourControl.Locked = Not Me.NewRecord


Anhy easy way to do this??
0
 
LVL 84
ID: 35089090
Whether the box is locked or enabled would have no impact on the Filtering, unless you're referring to the rightclick filter.

0
 

Author Comment

by:Patrick O'Dea
ID: 35089122
yes , I am referring to the right click filter.

What is the best (simplest) way to get a filter on this field??
Can I re-activate my right click one??
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 35089131
YOu can try Enabling the control and Locking it. Enabling it should allow you to interact with it, but keeping the Lock in place should stop people from updating it.

0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35089368
Got it now!


Thanks again
0

Featured Post

Backup Your Microsoft Windows Server®

Backup 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search for text in a .txt file 14 44
Delete QueryDef IF it Exists: Access VBA 5 34
Switch 5 16
Microsoft Access Reports & Sub Reports 3 11
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

770 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