[RESOLVED] select * from table1 where ftnumber like '%600';command prob in VB6
Hi :wave:
here iam having a problem with my code where i want to fetch the records from the text box as per requirement
this is the command actually working in mysql
select * from table1 where FTNumber like '%600';
where FTNumber is BIGINT(95 )
iam getting runtime error as '-2147217887(80040e21)'
here iam attaching my code
Quote:
Private Sub Command2_Click()
If Combo1.Text = "FTNumber" Then
RsAccess.Open "Select * from localcard where FTNumber like value '%" & Text1.Text & "' ", sConnect, adOpenKeyset, adLockOptimistic
On Error Resume Next
Dim I, J, rtot, m, n
Dim ctot(1 To 150)
rtot = 0
If RsAccess.RecordCount = 0 Then
MsgBox "Data not found. Pls check...", vbInformation, "Found Error"
RsAccess.Close
Exit Sub
ElseIf RsAccess.RecordCount <> 0 Then
Dim ObjExcel As Excel.Application
Set ObjExcel = New Excel.Application
ObjExcel.SheetsInNewWorkbook = 1
Set ObjExcel = ObjExcel.Workbooks.Add
Set objws = ObjExcel.Sheets(1)
objws.Rows(1).Font.Bold = True
With objws
.Range("A:A").NumberFormat = "[$-409]d-mmm-yy;@"
.Range("C: D").NumberFormat = "0"
.Range("G: H").NumberFormat = "0.00"
.Columns("C: D").ColumnWidth = 18
End With
For I = 0 To RsAccess.Fields.Count - 1
ObjExcel.ActiveSheet.Cells(1, I + 1).Value = RsAccess.Fields(I).Name '"SUPP-CODE"
Next
J = 2
Do Until RsAccess.EOF
For I = 0 To RsAccess.Fields.Count - 1
ObjExcel.ActiveSheet.Cells(J, I + 1).Value = RsAccess.Fields(I)
Next
RsAccess.MoveNext
J = J + 1
Loop
objws.Cells((J + 1), somecolumn).Value = J - 2
Dim k
k = 1
ObjExcel.Visible = True
RsAccess.MoveFirst
RsAccess.Close
Exit Sub
End If
End If
End Sub
Re: [RESOLVED] select * from table1 where ftnumber like '%600';command prob in VB6
This thread is marked resolved with no posted resolution.
Did you figure it out yourself? If so, please post your solution as it might help someone else with the same or similiar problem.
Thanks. :)
Re: [RESOLVED] select * from table1 where ftnumber like '%600';command prob in VB6
:eek2: Well i solved the problem and that is the solution :wave: