473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to create a search for a form to prevent overriding data in table

I have a database with a form containing all the membership data for each member and I would like to be able to search on any field without accidentally changing the data. When I open the Form it automatically loads data so the chance of accidentally changing data is high. And unfortunately once you type no go back....
Jan 9 '16 #1
1 886
zmbd
5,501 Expert Mod 4TB
Forms can be opened in a "read only state" in VBA and by design:

Open your form in design mode
Show the property sheet
IN the property sheet drop down list, select "Form"
Data tab
At the bottom are four "Allow" properties
When I am creating a review only form, I set
allow Additions, Deletions, and Edits to No.

HOWEVER,

When using a cascading combobox for a form filter, Allow Edits has to be set to yes and using VBA to open the form as a readonly state can cause issues; therefor, in this case, I use the form's before_update event to cancel the edit.

Once again, show the form's property sheet
Event tab
Before Update
click on the [...]
Code Builder

You will get a blank Form_BeforeUpdate(Cancel as Integer) procedure, set cancel to true and tell the form to undo any edits.

A very simple version of this is
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database 'do not duplicate
  2. Option Explicit 'do not duplicate
  3.  
  4. Private Sub Form_BeforeUpdate(Cancel As Integer)
  5.     Cancel = True
  6.     Me.Undo
  7. End Sub
I have code the tells the user that edits are not allowed and/or opens a new/edit-record form
Jan 10 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vishal | last post by:
how can i create a form which is when submitted calls itself i mean what to write in action property of form element thxs
6
by: skgolden | last post by:
My husband and I own a small temporary labor company and deal with 4 major clients (A,B,C & D), each of which has about 2 dozen units in our tristate area that we deal with (ie, Company A, units...
11
by: Ron L | last post by:
I have a data table that lists a series of items in my database. In my user form, I want the user to be able to filter by a number of criteria (e.g. location, contract, date modified, etc). Other...
25
by: ali3n8 | last post by:
Hello I would like to create a search form for my database that searches by: First Last Contact Number Street City State Zip
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2:...
8
by: munkee | last post by:
Hi everyone, I am using the following code adapted from Allen Browne: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few...
11
by: MadSma | last post by:
hi iam quite new to access and i am now at a stage where i have created my database tables and various forms to input data on them but i need a way of displaying data based on some search criteria ...
37
ashjones86
by: ashjones86 | last post by:
Hi All, So im looking for some help with access 2007 if at all possible. I am new to access as work has asked me to create a database, so the database side to it i have sorted i.e inputting data...
9
by: ittechguy | last post by:
I have a unbound form which contains no data. I need to populate the form and also 3 listboxes with data using a search form which contains several search boxes in the header of my form. My idea...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.