Skip to Content
0
Former Member
Nov 20, 2009 at 05:36 AM

Combo value

37 Views

I am performing validation on the A/R invoice.I have considered transaction category

and form no from the tab tax.If the value in the form no. is FORM 'C' or FORM 'H' or FORM 'I'

or CONCESSIONAL FORM or DEXPORT then Sales should be transaction category.But I am

not able to access the value of combo.When I select any value and then execute my code

it gives error.The code is as,

 Private Sub ValidateFormC()
        Dim txtFormC, txtCategory As SAPbouiCOM.EditText
        Dim ddlCategory As SAPbouiCOM.ComboBox
        Dim strCategory As String

        Try
            objForm = SBO_Application.Forms.ActiveForm
            If objForm.Visible = True Then
                txtFormC = objForm.Items.Item("2067").Specific
                If txtFormC.Value.Length > 0 Then
                    If txtFormC.Value <> "FORM 'C'" And txtFormC.Value <> "FORM 'H'" And txtFormC.Value <> "FORM 'I'" And txtFormC.Value <> "CONCESSIONAL FORM" And txtFormC.Value <> "DEXPORT" Then
                        SBO_Application.MessageBox("Form No. should be FORM 'C' or FORM 'H' or FORM 'I'or CONCESSIONAL FORM or DEXPORT")
                        Exit Sub
                    End If
                    ddlCategory = objForm.Items.Item("2068").Specific
                    strCategory = ddlCategory.Selected.Description  'Error fires here.
                    If IsNothing(ddlCategory.Selected) = False Then
                        If ddlCategory.Selected.Value = "" Then
                            SBO_Application.MessageBox("Please select Transaction Category")
                        ElseIf ddlCategory.Selected.Value <> "Sales" Then
                            SBO_Application.MessageBox("Please select Sales as Transaction Category")
                        End If
                        'Else
                        '    txtCategory = objForm.Items.Item("2068").Specific
                    End If
                End If
            End If
        Catch ex As Exception
            SBO_Application.MessageBox("ValidateFormC()=" & ex.Message)
        Finally
            txtFormC = Nothing
        End Try
    End Sub

strCategory = ddlCategory.Selected.Description

The above code gives error as,

Object reference not set to an instance of an object.