Solved

Add - Modify Data

Posted on 2011-03-09
9
216 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 119

Expert Comment

by:Rey Obrero
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
 

Author Comment

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


a perfect solution!
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

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.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now