Results 1 to 2 of 2

Thread: Find help in ADO

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44

    Post

    Hello
    Now, I tried to make a new Application where in this program have a button such as :
    First, Previous, Next, Last, Find.
    table name : offmat
    field : omat_code
    omat_name
    omat_unit

    Dim myconn As New ADODB.Connection
    Dim myrec As New ADODB.Recordset

    In event Find Click, i put a statement :

    myrec.open "select * from offmat where omat_code ='" & trim(txtfield.text) & "'",myconn, adOpenDynamic, adLockOptimistic, adCmdText
    if (myrec.bof <> true) and (myrec.eof <> true then
    call displayrecord
    check = true
    endif
    myrec.close

    if check = false then
    msgbox "Data cann't be found"
    endif

    When I run the current the record is first record and I can move the record with press button first or previous or next or last.
    Example now the current record is first record then i press find button( to find record seven) and i put data.
    When it's find then the data to show, but when data show first or previous or next or last button not work.
    I want when data to find is record of seven and when i press next button current record will move to record of eight or previous record
    current record will move to record of six.
    I have tried it with statement

    myrec.open "offmat",myconn, adOpenDynamic, adLockOptimistic, adCmdText
    myrec.movefirst
    do while not myrec.eof
    if trim(myrec!omat_code) = txtfield.text then
    call displayrecord
    check = true
    exit do
    endif
    myrec.movenext
    loop
    myrec.close

    if check = false then
    msgbox "Data cann't be found"
    endif

    This code it's work like i want but if in my table have 1000 record it will be take a long time to find
    So somebody can help me ?


    Regard's


    Long




    [This message has been edited by Long (edited 10-12-1999).]

  2. #2
    New Member
    Join Date
    Oct 1999
    Posts
    3

    Post

    Hi,
    Can u tell me what's the code which u have put in other buttons.

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