Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Form field write protecting

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…

670 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