Locking/Enabling Combo Box in Form

B

BMoroneso

I want to lock all the data fields in a form when I open it, leaving only the
filter combo boxes available for use.

Three of the data fields are combo boxes (InsurerID, TypeID, and ProdCatID).
The code I've used is below.

DoCmd.OpenForm "frmProducts", acNormal, "", "", , acNormal
Forms!frmProducts.ProductName.SetFocus
Forms!frmProducts!InsurerID.Enabled = False
Forms!frmProducts!TypeID.Enabled = False
Forms!frmProducts!ProdCatID.Enabled = False
Forms!frmProducts!ProductName.Locked = True
Forms!frmProducts!DateIntroduced.Locked = True
Forms!frmProducts!DateRetired.Locked = True
Forms!frmProducts!frmCommSetup.Locked = True

The enabled = false setting works for the first two combo boxes, but not the
third, and the locked = true setting doesn't work for any of them. The error
message returned is "Object doesn't support this property or method." But,
everything I have read online and in books says it should work with no
problems...

Any advice is appreciated!!
 
B

BMoroneso

Thanks for the code. I will try it out. Do you by chance know why the
..locked and/or .enabled properties are not working with the code that I wrote?
Thanks,
Becky
 
B

BMoroneso

Also, I must be doing something wrong because the code didn't lock any of the
controls. Help?
 
B

BMoroneso

It's just the combo boxes with sql as a source that break the code. I've
been through the 'commenting out' process and those are the only ones that
cause trouble. Other combo boxes with a value list work just fine.
 

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