Solved

Form field write protecting

Posted on 2003-12-04
3
322 Views
Last Modified: 2008-03-04
I have actually two questions which are related. I am using a form to enter data into a table. When opening the form the first record in the table appears. What can easily happen is that you write over this entry.
To prevent this I want to do two things;
1) When opening the form I would like it to present the next record to be entered (blank record). That is if I currently have 20 records I want it to display record 21 which is blank.
2) How can I write protect (from the form) the current records so they cannot be accidentaly deleted or altered.
It still might be necessary to edit the records but this should be done through the table.

Thank you in advance
twallstr
0
Comment
Question by:twallstr
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 50 total points
ID: 9873961
1) Set the forms Data Entry property to Yes. This will not show all the previous records though. If you want to see all the previous records, leave Data Entry property as No and paste this code into your form:

Private Sub Form_Load()
  DoCmd.GoToRecord , , acNewRec
End Sub


2) Set the forms Allow Edits property to No
0
 
LVL 9

Expert Comment

by:svenkarlsen
ID: 9874603
You could also put some code in to handle it, so thatno edit is normally allowed, unless the user clicks a button saying explicitly that he/she wants to edit the record.

In the OnCurrent Event of the form, put these two line:

me.allowedits=False
me.ToggleButton=0

Then make a toggle-button (on/off-button), and put this code in the onClick event of the button:

   If (Me.ToggleButton.Value = -1) Then
      me.allowedits=true
   Else
   me.allowedits=false
   End If

Replace "ToggleButton" with the name you give the button on it's property page


Sven
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 9874670
oh, and leading on from 2, Setting Allow Deletions to False means that they can't delete any records.
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.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

810 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