Locking/Enabling Combo Box in Form

  • Thread starter Thread starter BMoroneso
  • Start date Start date
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!!
 
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
 
Also, I must be doing something wrong because the code didn't lock any of the
controls. Help?
 
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.
 
Back
Top