XLEAccessGuru
XLEGuru
- Local time
- Today, 14:42
- Joined
- Nov 17, 2006
- Messages
- 65
This is a really stupid question but I gotta ask.
Does anyone know some VBA that will count records in a combo box on a subform? I need to do this because some of my requestors in the DB are responsible for more than one department. Their names auto fill, but I need to remind them to select a department if the DEPARTMENT combo box contains more than one value in the drop down list. The challenge is that the combo box is on a subform. Current code returns a "Object doesn't support this property or method" error. Here's the code that's currently using the "RecordCount" property - is there something else I can do here to determine the # of values in this combo box?
Does anyone know some VBA that will count records in a combo box on a subform? I need to do this because some of my requestors in the DB are responsible for more than one department. Their names auto fill, but I need to remind them to select a department if the DEPARTMENT combo box contains more than one value in the drop down list. The challenge is that the combo box is on a subform. Current code returns a "Object doesn't support this property or method" error. Here's the code that's currently using the "RecordCount" property - is there something else I can do here to determine the # of values in this combo box?
Code:
If Forms![frmCustomerRequest]![REQUESTOR_INFORMATION].Form![DEPT_Name].RecordCount > 1 Then
MsgBox "You are responsible for more than one DEPARTMENT. " _
& "Please select a department from the drop-down list. ", vbInformation, "Department Validation"
End If