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 & "%'" 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




Reply With Quote