Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #11 (permalink)  
Old January 18th, 2007, 11:06 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Oh, does your form have an unbound combobox to allow searching for specific records on it, and when you choose a name the record jumps to the name selected? Yes, that is very annoying that this combobox also becomes usesless when you set the AllowEdits property of the form to FALSE.

To get the best of both worlds, you'll have to keep the AllowEdits property of the form always to TRUE. In that case, you'll have to toggle all the LOCKED property of each element to true/false instead. To do them all at once:

First, in those controls where you don't want them to get locked, e.g. that combox box, any command buttons, etc. Write something in their TAG properties, e.g. Exempt. Then in the form's ON CURRENT event, you can put this

Code:
Dim ctlControl as Control

For Each ctlControl in Me
    If ctlControl.Tag <> "Exempt" Then
        ctlControl.Locked = True
    End If
Next ctlControl
Then when you want to allow editing, you do the same code on the button's ON CLICK event, but set Locked to False.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
  #12 (permalink)  
Old January 18th, 2007, 11:30 AM
Friend of Wrox
 
Join Date: Jan 2005
Location: Kansas City, Missouri, USA.
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Donevco,
With all the great solutions you've already gotten, I have 1 more.

What I have always done is create a form that is not bound to anything.
Create unbound controls for each field you want the user to see from the recordset.

In the after update event of your combobox, open the recordset, load all the fields on your form from the data, then close the recordset, and set your combobox to enabled = no.

Now your user can manipulate the fields on your form to their hearts content, but no updates, inserts etc., are happening anywhere except on the form.

With a command button for updating the record, use a msgbox to ask them if they are sure they want to update and if yes, reopen the recordset using the same code from the after update event of your combobox, then update the recordset utilizing the values from the form.

The only problem with this solution, is when you are in a multi-user environment where someone else may be updating the same record at the same time.

Kevin




dartcoach




Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate running total on form and prevent text Hughesie78 ASP.NET 2.0 Basics 0 November 27th, 2007 10:35 AM
UpDate Records on a Form ManFriday Access 2 September 8th, 2007 04:21 AM
Update Table From Form ksbrain Access 2 January 9th, 2007 01:49 PM
How to Update a Listbox on Different Form boxwalah C# 2 February 24th, 2006 12:22 PM
Locking down my Form to prevent close or break donaldjlynch Access VBA 1 July 27th, 2003 09:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.