Results 1 to 5 of 5

Thread: visual basic run time error 5 class

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2011
    Location
    Trichy,Tamil Nadu,India
    Posts
    3

    Exclamation visual basic run time error 5 class

    Dear Friend,

    I'm getting problem in vb class module.I have no idea about class module but i was created class file. When i run my application it showing run time error '5'.

    Any one can help me for this problem.

    In form code:
    Code:
    Dim List As SpdListing
    If KeyCode = vbKeyF2 Then
        DoEvents
        Set List = New SpdListing --> Here i am getting error
            List.Class_Initialize
        With List
            .SpdShowList Me, SpdStyle, SpdStyle.ARow, SpdStyle.ActiveCol, "StyleId", "Style", "Style", Qry = ""
        End With
        
    End If
    
    Class Module Code:
    
    Public Type SpdList
        Frm As Object
        spd As Object
        ARow As Integer
        ACol As Integer
        Field1 As String
        Field2 As String
        TblObj As String
        Qry As String
    End Type
    
    Public Function SpdShowList(CurrentFrm As Object, Currentspd As Object, ARow As Integer, ACol As Integer, Field1 As String, Field2 As String, TblObj As String, Qry As String) As String
    Dim List As SpdList
    With List
    .Frm = CurrentFrm
    .spd = Currentspd
    .ARow = ARow
    .ACol = ACol
    .Field1 = Field1
    .Field2 = Field2
    .TblObj = TblObj
    .Qry = Qry
    Strsql = "Select " & .Field1 & VBA.chr(13) & "," & VBA.chr(13) & .Field2 & VBA.chr(13) & " From " + .TblObj
    If .Qry <> "" Then
        Strsql = Strsql & VBA.chr(13) & " Where " & VBA.chr(13) & .Field1 & VBA.chr(13) & " In(" & .Qry & ")"
    Else
        Strsql = Strsql & VBA.chr(13) & " Where " & .Field1 & "='" & FrmSpdListing.SpdFilter.Text & "&#37;'"
    End If
    End With
    Set SpdRs = New ADODB.Recordset
    SpdRs.Open Strsql, SpdCn, adOpenStatic, adLockReadOnly
    Set FrmSpdListing.SpdGrid.DataSource = SpdRs
    'FrmSpdListing.SpdGrid.Columns(0).Width = 0
    FrmSpdListing.Show
    End Function
    Last edited by si_the_geek; Jan 3rd, 2011 at 06:51 AM. Reason: added Code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width