Solved

Add - Modify Data

Posted on 2011-03-09
9
220 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
[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
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

739 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