|
-
Jan 3rd, 2011, 03:38 AM
#1
Thread Starter
New Member
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 & "%'"
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
-
Jan 3rd, 2011, 06:52 AM
#2
Re: visual basic run time error 5 class
Welcome to VBForums 
Thread moved from the 'CodeBank VB6' forum (which is for you to post working code examples, not questions) to the 'VB6 and earlier' forum
-
Jan 3rd, 2011, 08:10 AM
#3
Thread Starter
New Member
Re: visual basic run time error 5 class
Hi si_the_geek,
Thanks to inform me. Since i am new person in this fourm. SO can u tell me how to post my question.
Thanks
-
Jan 3rd, 2011, 08:25 AM
#4
Re: visual basic run time error 5 class
Set List = New SpdListing --> Here i am getting error
List.Class_Initialize
You don't show the Class_Initialize code, which may be causing the error.
BTW, the Set statement above causes the Class_Initialize code to be
executed.
Also, even if the Class_Initialize code didn't cause an error,
the line List.Class_Initialize would cause another error, since Class_Initialize
is private to the class.
-
Jan 3rd, 2011, 08:41 AM
#5
Thread Starter
New Member
Re: visual basic run time error 5 class
 Originally Posted by VBClassicRocks
You don't show the Class_Initialize code, which may be causing the error.
BTW, the Set statement above causes the Class_Initialize code to be
executed.
Also, even if the Class_Initialize code didn't cause an error,
the line List.Class_Initialize would cause another error, since Class_Initialize
is private to the class.
Thanks it is working.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|