Results 1 to 2 of 2

Thread: Check This coding

  1. #1

    Thread Starter
    Fanatic Member bharanidharanit's Avatar
    Join Date
    Oct 2008
    Location
    India
    Posts
    673

    Check This coding

    My check1 recordset contains no1 field with 11/2, 5/3, 4, 6
    So this coding converts them to decimal by dividing 11/2 etc.
    But this is done when the datas are in fraction form but not with others.
    (ie) it converting only 11/2 and 5/3 but not 4 and 6.
    Pls help me in converting them also.

    Private Sub Command1_Click()

    rs.Open "check1", db, 3, 2
    Do While Not rs.EOF
    Set lvwItem = ListView1.ListItems.Add(, , rs.Fields.Item(0).Value)
    rs.MoveNext
    Loop
    rs.Close
    For i = 1 To ListView1.ListItems.Count
    Set item1 = ListView1.ListItems(i)
    a = Left([item1], InStr([item1], "/") - 1)
    b = Right([item1], Len([item1]) - InStr([item1], "/"))
    c = IIf([b] = [item1], [item1], ([a] / [b]))
    MsgBox c
    Next

    End Sub

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Check This coding

    Something like this?

    Code:
    For i = 1 To listview1.listitems.Count
       'determine existence of /
        If InStr(listview1.listitems(i), "/") > 0 Then
            'convert
        End If
    Next
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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