View Single Post
  #11 (permalink)  
Old January 18th, 2007, 11:06 AM
SerranoG SerranoG is offline
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