Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Form field write protecting

Posted on 2003-12-04
3
Medium Priority
?
331 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 200 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

927 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