By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

Locking controls locks another form up...why?

P: n/a

I have 2 forms FrmMain and frmSearch.

On frmMain I have to lock the textboxes and combo boxes on the form if
the user logged out that record.

FrmMain has a command button that launches frmSearch.
While frmSearch (which is a regular form, not modal/popup,etc) is up,
frmMain sits in the background.

The problem is: when frmMain is displaying a locked record, and
frmSearch is launched, the combo boxes and text boxes in frmSearch are
also locked!
Testing frmSearch by itself outside of frmMain showed the controls on
frmSearch to behave normally.

Here is the code that locks the controls on frmMain:
(this locks all controls nicely on frmMain)
For Each ctl In Forms!frmmain.Controls
If ctl.ControlType = acTextBox Then
ctl.BackColor = &HC0FFFF
ctl.Locked = True
End If

'lock the combo boxes that are here too
If ctl.ControlType = acComboBox Then
ctl.BackColor = &HC0FFFF
ctl.Locked = True
End If

Next ctl
So where in this code is a reference to frmSearch or another open form
for that matter that all control on all forms are getting locked?

Many thanks for your assistance...

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Looks strange, have you tried debugging something like:

For Each ctl In Forms!frmmain.Controls
If ctl.ControlType = acTextBox Then
ctl.BackColor = &HC0FFFF
ctl.Locked = True
debug.print "Locked " & ctl.Name & ",
frmSearch!TextBoxName.locked = " & Forms!frmSearch!TextBoxName.locked
End If
That way you'll be able to see exactly where it happens
Terry Bell

Nov 13 '05 #2

P: n/a
RLN

I had to specify the exact control....works now!
Thanks for the tip!

----------
"Perseverance - there is no substitute for hard work."
- Thomas Alva Edison

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.