Hi all,
I am trying to create an after update event using a combo box but with the following code it returns a runtime error 2494 Action or method requires a form name argument.
Ideally I would love for it to open a subform based on the value but I dont know how to do that. Heres the code, any ideas whats wrong:
I am trying to create an after update event using a combo box but with the following code it returns a runtime error 2494 Action or method requires a form name argument.
Ideally I would love for it to open a subform based on the value but I dont know how to do that. Heres the code, any ideas whats wrong:
Code:
Private Sub cboUtilityCategoryName_AfterUpdate()
Dim cboVal As String
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[fkAccountID]=" & Me![AccountID]
cboVal = Me.cboUtilityCategoryName.Value
Select Case cboVal
Case "Electric"
stDocName = "frmSitesMeterPointsMPAN"
Case "Red"
stDocName = "Red Form"
Case "Green"
stDocName = "Green Form"
End Select
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub