Thanks John,
Now I am out of my depth! I will need to be led by the hand to complete your advice.
I can't find a 'Locked' property. I have this in the 'On Current' property as a start.
Private Sub Form_Current()
If Me.Unit = 1000 Then
Me.Unit.Locked = True
Else
Me.txtName.Locked = False
End If
End Sub
i) Why do we use "If Me.Unit = 1000 Then" when we need to cover any entry. The are all numeric.
ii) I have used the 'FieldName' to replace your 'Numberfld'. Is that correct.
iii) I have substituted 'FieldName' for 'txtname" is that correct.
I suspect that all of the above is wrong because it does not work!
After writing the above I edited your work, placed it in the "On Current" event and it appears to work!
Private Sub Form_Current()
If Me.Unit < 1000 Then
Me.Unit.Locked = True
Else
Me.Unit.Locked = False
End If
End Sub
What next?
Cheers,
Robin
At 6/06/2014 07:25 AM, you wrote:
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
http://www.viescas.com/
(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: Robin Chapple <robinski@westnet.com.au>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar