Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:32 AM.


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