Error comes ...!!!! with object must be user defined type,object,or variant... Please help me.....

Aug 9, 2010 at 1:22 AM
From Kishan:

Please kindly help me out ...
I working on Visual Basic 6.0

Just Adding one new option in the form the error comes. I unable to understand the code. Please anybody help me.

The Code is

Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdShowList_Click()
Dim strQry As String
Dim strColor As String
Dim strRegYear As String
Dim strManuYear As String
Dim strCity As String
Dim rcTempRecSet As New ADODB.Recordset
Dim strUserID As String, intCount As Integer
Dim dblRecCount As Double
Dim strInspectionDt As String
'If Trim(cboUsers.Text) = "" And Trim(cboUsers.Text) = "" Then
If optListNonUse.Value = True Then
With RCReports
If .RepCnn.State = adStateClosed Then .RepCnn.Open
If .Recordsets("cmdListNonUseVeh").State = adStateOpen Then .Recordsets("cmdListNonUseVeh").Close
.cmdListNonUseVeh CDate(txtFromDt.Text), CDate(txtUptoDt.Text)
If (.rscmdListNonUseVeh.RecordCount) > 0 Then
dblRecCount = .rscmdListNonUseVeh.RecordCount
rptListNonUseVeh.Sections("Footer").Controls("lblTotal").Caption = "Total Records: " & dblRecCount
'rptListNonUseVeh.Orientation = rptOrientLandscape
rptListNonUseVeh.Refresh
rptListNonUseVeh.Show vbModal
Else
MsgBox "No data found.", vbCritical
End If
End With
End If


'' New Added Code ''
If optprevowner.Value Then
With RCReports.cmdPrevOwner
If .RepCnn.State = adStateClosed Then .RepCnn.Open
If .Recordsets("cmdPrevOwner").State = adStateOpen Then .Recordsets("cmdPrevOwner").Close
cmdPrevOwner Left(cmdPrevOwner.Text, 2), Left(cmdPrevOwner.Text, 2)
If (.cmdPrevOwner) > 0 Then
dblRecCount = .cmdPrevOwner.RecordCount
' rptPrevOwner.Sections("ReportFooter").Controls("lblTotal").Caption = "Total Records: " & dblRecCount
'rptApprvlPendg.Orientation = rptOrientLandscape
rptPrevOwner.Refresh
rptPrevOwner.Show vbModal
Else
MsgBox "No data found.", vbCritical
End If
End With
End If

End Function


When i adding this code which is blue in color the error comes

ERROR
: with object must be user defined type,object,or variant...
With a POP BoX.


I am unable to undesstand what the basically problem is. Can anybody help me out.

Thanks in advance