lock controls on continuous form based on condition

  • Thread starter Thread starter mcnews
  • Start date Start date
M

mcnews

i need to lock 5 controls on any row of a continuous form where all 5
of these controls on each row contain data.

how to?

tia,
mcnewsxp
 
I don't like to deliver bad news but I think you can't.

If you lock the field, it will be lock for all record in your form. Unless
there something I am not thinking about ( There is often other ways to do
things), you can't do it.

Sorry,
 
You will need to do so in the Current Event of the form

Private Sub Form_Current()
If IsNull(Me.Control1) or IsNull(Me.Control2) or IsNull(Me.Control3) or
IsNull(Me.Control4) or IsNull(Me.Control5) Then
Me.Control1.Locked = False
Me.Control2.Locked = False
Me.Control3.Locked = False
Me.Control4.Locked = False
Me.Control5.Locked = False
Else
Me.Control1.Locked = True
Me.Control2.Locked = True
Me.Control3.Locked = True
Me.Control4.Locked = True
Me.Control5.Locked = True
End IF
End Sub
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
You can use the Disabled property of the FormatConditions object for each
control. Lookup Conditional Formatting in Access Help.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
that works but had to add

If (IsNull(Me.Control1) Or IsNull(Me.Control2) Or IsNull(Me.Control3)
Or _
IsNull(Control4) Or IsNull(Me.Control5)) Or _
(Me.Control1 = "" Or Me.Control2 = "" Or Me.Control3 = "" Or
Me.Control4 = "" Or Me.Control5 = "") Then

thanks much!
 
You can use the Disabled property of the FormatConditions object for each
control. Lookup Conditional Formatting in Access Help.

i took a look at conditional formatting.
it didn't look so pretty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top