Solved

Form field write protecting

Posted on 2003-12-04
3
320 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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