Results 1 to 3 of 3

Thread: [RESOLVED] select * from table1 where ftnumber like '%600';command prob in VB6

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Location
    Banglore
    Posts
    95

    Resolved [RESOLVED] select * from table1 where ftnumber like '%600';command prob in VB6

    Hi
    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

    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
    Last edited by maheshkanda; Jan 9th, 2009 at 04:48 AM.

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