problem opening different forms with hidden combo box (1 Viewer)

jjake

Registered User.
Local time
Today, 15:40
Joined
Oct 8, 2015
Messages
291
Hello,

I have a navigation form for entering equipment ID's.

On this form is a combo box based on a table "EquipmentType"

e.g

1 | Pumps
2 | Vehicles
3 | Storage Tanks

Hidden on the form are 3 individual "subtype" combos

During data entry if EquipmentType = 1 then "Pumpsubtype" combo box is unhidden to allow data entry and so on for the additional combo values.

Each sub type has an individual form associated with it to enter more specific details regarding that piece of equipment.

I get an issue with my code because it cannot see the hidden combo box to check the values. "Method or data member not found" How would i go about this?


Code:
If MsgBox("Would you like to enter details for this equipment now?", vbYesNo + vbQuestion) = vbYes Then

If Me.EquipmentType.Value = 1 Then
DoCmd.OpenForm "frmReactorDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

ElseIf Me.EquipmentType.Value = 2 Then
DoCmd.OpenForm "frmBlenderDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

ElseIf Me.EquipmentType.Value = 3 Then
DoCmd.OpenForm "frmStorageTankDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

ElseIf Me.EquipmentType.Value = 4 And Me.UtilitySubType.Value = 1 Then
DoCmd.OpenForm "frmBoilerDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

    ElseIf Me.EquipmentType.Value = 4 And Me.UtilitySubType.Value = 2 Then
    DoCmd.OpenForm "frmCoolingTowerDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

    ElseIf Me.EquipmentType.Value = 4 And Me.UtilitySubType.Value = 3 Then
    DoCmd.OpenForm "frmGeneratorDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID
    
    ElseIf Me.EquipmentType.Value = 4 And Me.UtilitySubType.Value = 4 Then
    DoCmd.OpenForm "frmWellDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID
    
    ElseIf Me.EquipmentType.Value = 4 And Me.UtilitySubType.Value = 5 Then
    DoCmd.OpenForm "frmAirCompressorDetailsEdit", , , "[Equipmentid] = " & Me.EquipmentID

End If
End If
End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,474
Hi. It might be easier if you could post a sample copy of your db. Controls may be hidden from view but they can't really hide from code. So, even if you can't see the control, your code should be able to.
 

jjake

Registered User.
Local time
Today, 15:40
Joined
Oct 8, 2015
Messages
291
Could it be because the combo box doesn't have a value yet?
 

jjake

Registered User.
Local time
Today, 15:40
Joined
Oct 8, 2015
Messages
291
Well i made a whoopsie. i found a typo in my combo box name :eek:

Sorry.
 

Users who are viewing this thread

Top Bottom