A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Lock



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2009, 07:31 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 6
Default Lock

I need to be able to lock Detailed Description field in a form when
the field contains
data. Obviously when creating a new record I need to be able to enter
data in
the field. I can lock the whole record and I can lock the field at
the
moment but it then does not allow me to enter data in new records
I tried the below codes:
Private Sub Detailed_Description_AfterUpdate()
Me.Detailed_Description = Now & ", " & Me.Detailed_Description
Me.Detailed_Description.Locked = Not IsNull(Me.Detailed_Description)
End Sub


And I also tried:

Private Sub Detailed_Description_AfterUpdate()
Dim blnUnlockControl
blnUnlockControl = Not Me.NewRecord
Me.Detailed_Description.Locked = bnlUnlockControl

Me.Detailed_Description = Now & ", " & Me.Detailed_Description
Me.Detailed_Description.Locked = Not IsNull(Me.Detailed_Description)
End Sub

And I tried:

Private Sub Detailed_Description_AfterUpdate()
If IsNull(Detailed_Description) Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
Me.Detailed_Description = Now & ", " & Me.Detailed_Description
End Sub

None of them worked....Can someone tell me please what I'm doing wrong
here

Thanks,

Mark
  #2  
Old February 25th, 2009, 07:47 PM posted to microsoft.public.access.forms
ghetto_banjo
external usenet poster
 
Posts: 325
Default Lock

Put code to unlock the text box in the On Current event of the Form
(this event runs as the form loads or changes a record).

Private Sub Form_Current()

if isnull(detailed_description) then
detailed_description.locked = False
end if


 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.