Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock Controls

Status
Not open for further replies.

Kherozen

Programmer
Jun 5, 2003
129
CA
Hi,
Probably a redundant question, so I apologize for not having search as deeply as possible.

I got a form with a mandatory control(field) to fill and I want to lock any other controls(fields /combo/list) if that control is empty and pop-up a message if some try to fill them before the mandatory one. I could probably do it one by one but I'm looking for a more adaptative method since I've got a lot of them.

thx.


jul ^_^
"Computer Science is no more about computers than astronomy is about telescopes"
E. W. Dijkstra.
 
You could try using the On Open of the form with an if statement and case statements.

If [mandatory control] isnull then

case1
[field1].visible = false

By making the visibility false until something is put in the mandatory control would in essence not have those fiels show.


HTH

An investment in knowledge always pays the best dividends.

by Benjamin Franklin
 
Well as I said I got a lot of those controls so the swithing visible/invisble is not really something interessting since my form gonna look pretty ugly with just a control in it.




jul ^_^
"Computer Science is no more about computers than astronomy is about telescopes"
E. W. Dijkstra.
 
try the code below in the On Current event
If isnull(mandatory control)Then
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False

End With
Else
With frm
.AllowAdditions = True
.AllowDeletions = True
.AllowEdits = True
End With
End If
[mandatory control].locked = False

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top