Locking text boxes and subforms

J

James

Hello I can call the following module on some of my forms
which locks certain things and displayes a message.

----------------------------------------------------------
Option Compare Database
Public Warning As String
Sub SetWarning()
Warning = "You have got RESTRICTED access to edit
data."
End Sub
Sub Restrict(TheSubForm As Object, TheText As Object)
If UsrUserID = 3 Then
TheSubForm.Locked = True
TheTextBox.Locked = True
TheText.Caption = Warning
End If
End Sub
----------------------------------------------------------

How could I modify it so theat the message appears in red
and is bold? also I would like it to select all the
subforms and text boxes on the form and lock them all.
Could I also do the same thing but for a list box which
has values but not lock it but stop edits and things so
all you can do is click on a value and do the same with a
combo Box?

Many Thanks

James
 
C

Cheryl Fischer

How could I modify it so theat the message appears in red
and is bold?

You can change the ForeColor and FontWeight properties of the (presumed)
label control, TheText
also I would like it to select all the
subforms and text boxes on the form and lock them all.

See the responses to your previous post on this subject: You can either do
this by setting the form's AllowEdits, AllowDeletions and Allow Additions
properties to No or you can loop through the control types, setting the
Locked property to Yes or No as you wish. To see a list of all of the
intrinsic constants for ControlType, use VB Help and search on
"ControlType". As for SubForms, they will be locked when you set their
parent form's AllowEdits, AllowDeletions and Allow Additions properties to
No.
Could I also do the same thing but for a list box which
has values but not lock it but stop edits and things so
all you can do is click on a value and do the same with a
combo Box?

ListBoxes: Set the Locked Property to No.
ComboBoxes: Set the Locked Property to No and set the Limit to List
Property to Yes
 

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

Top