Solved

Form field write protecting

Posted on 2003-12-04
3
327 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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