PC Review


Reply
Thread Tools Rate Thread

Controlling Edits

 
 
E.Q.
Guest
Posts: n/a
 
      18th Dec 2009
I have a subform in datasheet view. I'd like to lock the text box named
chrMeasureName for existing records but allow users to enter it in new
records.
I've tried this code

Private Sub Form_Current()
If Me.NewRecord Then
Me.chrMeasureName.Enabled = True
Me.chrMeasureName.Locked = False
Else: Me.chrMeasureName.Enabled = False
Me.chrMeasureName.Locked = True
End If
End sub
This works until chrMeasureName (a text box) is selected in the new record
row and one of the records above is clicked. This generates an error for
trying to disable a control that has focus.
Is it possible to limit edits the way I want. I'm wondering if I can solve
this through error handling or if there's another approach. I thought one
solution would be to have two different forms, one to allow new entries and
another to enter measure descriptions, but I'm hoping there's a more elegant
solution.
Thanks
EQC
 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      18th Dec 2009
hi,

On 18.12.2009 09:18, E.Q. wrote:
> This works until chrMeasureName (a text box) is selected in the new record
> row and one of the records above is clicked. This generates an error for
> trying to disable a control that has focus.

You can use the ActiveControl property of the form to determine which
control is focused.

> Is it possible to limit edits the way I want. I'm wondering if I can solve
> this through error handling or if there's another approach.


If Me.ActiveControl = chrMeasureName Then
otherControl.SetFocus
End If
chrMeasureName.Enabled = False

And use the error handling method as fallback.


mfG
--> stefan <--
 
Reply With Quote
 
E.Q.
Guest
Posts: n/a
 
      19th Dec 2009
Thanks, this was the last piece needed to generating a front end that
contains the features the users said they wanted. Your help is greatly
appreciated.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling Allow Edits Property Peter Hallett Microsoft Access Form Coding 6 6th Jun 2008 05:52 PM
Controlling Edits =?Utf-8?B?bWRhdmlz?= Microsoft Access Forms 1 28th Mar 2006 08:56 PM
Allow Edits Garry Jones Microsoft Access Getting Started 1 21st Jan 2006 06:00 PM
Too many edits =?Utf-8?B?TFlB?= Microsoft Word Document Management 1 28th Apr 2005 05:09 PM
Controlling Sub-form data entry,edits,additions and deletions =?Utf-8?B?UnVzcw==?= Microsoft Access Form Coding 0 24th Feb 2004 04:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:00 AM.