Kamis, 05 Juni 2014

Re: [MS_AccessPros] Field not to be edited

 

Robin-


Yup.  Just set the Locked property of the control to True.  

Private Sub Form_Current()
    If Me.Numberfld = 1000 Then
        Me.txtName.Locked = True
    Else
       Me.txtName.Locked = False
    End If
End Sub

Note that I included the Else to set to unlocked for all records except the one I want.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jun 5, 2014, at 3:18 PM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


Thanks John,

For the past many years all my Access work has been internet based and forms are generated by a third party ASP code generator and I am able to present a field on a page as 'Read Only'. Is there an Access function for a field on a form?

Cheers,

Robin

At 5/06/2014 10:24 PM, you wrote:

There's no way to do it in the table (you could do it in SQL Server with a Trigger). You'll have to put code in the Current event of the form you use to edit the table. When you encounter the record, lock all the editable controls.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

On Jun 5, 2014, at 6:23 AM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I have a table which will not grow any more records. The existing
records, with one exception, will be edited.

How do I make that one exception incapable of change?

It cannot be the Key index field because some of the excepted fields
are null and must stay that way.

Many thanks,

Robin Chapple

------------------------------------
Posted by: Robin Chapple <robinski@westnet.com.au>
------------------------------------

Yahoo Groups Links


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar