I am using ACCESS 2002 SP3 and running into a problem. In the main form the user selects an item type from a drop-down list. If it is equal to Equipment or Vehicle then select fields are supposed to appear in a subform embedded on the main form. The area where I'm having difficulty is trying to reference the subform controls from the main form. I've copied my code below, if anyone has any suggestions on how to make this work I would greatly appreciate any help. Thanks!
Thanks again,
Steve
Code:
Private Sub cboItemType_AfterUpdate()
'Sends the item type from the main form to the sub-form, this may not be necessary if I can get the control feature to work right.
Me.subfrmSalesInternet.Form.cboItemType = Me!cboItemType
'Tells the subform to look at the "tag" line in each control to search for Equipment and Vehicle and display if they match.
Dim ctl As Control, Detect As String
Detect = "EquipmentVehicle"
For Each ctl In Me.subfrmSalesInternet.Form.Controls
If ctl.Tag <> "" Then
If InStr(1, Detect, ctl.Tag) > 0 Then
'This next line is where I am having problems
Me(ctl.Name).Visible = (Nz(Me.cboItemType, "") = ctl.Tag)
End If
End If
Next
End Sub
Thanks again,
Steve