Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Search Code???

  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Thanked 0 Times in 0 Posts

    Search Code???

    Hello All,

    I know that know one like to mess with data access pages in access and that My SQL would be better....however, this is all I have to work with at the moment. Now to the question...

    I am trying to create a search button to look up records in my access data base by "Site Number" I have been trying this code below but I am getting an error on line 189 char 26

    <SCRIPT language=vbscript event=onclick for=cmdFind>

    'This routine searches all fields in the defaultrecordset for something
    'entered by a user in a Search text box. It passes through each field
    'the recordset until it finds a match.
    dim i 'Counter variable
    dim rs 'ADO recordset object
    dim fld 'ADO field object
    dim FieldCount 'Number of fields in the recordset

    FieldCount = MSODSC.DefaultRecordset.Fields.Count

    'This will return the default recordset on the page
    'in this case, the Customers table.
    set rs = MSODSC.DefaultRecordset

    for i = 0 to FieldCount - 1
    'get a field object
    set fld = rs.Fields(i)

    '0 = Skip no records
    '1 = Search forward
    '1 = Start with the first record
    rs.Find fld.name &amp; " = '" &; txtSearch.value &; "'", 0, 1, 1

    'Check for EOF. If at EOF but have not exhausted
    'all the fields, then reset to the first position in the
    'recordset. Otherwise, if a match was found, exit the loop.
    if rs.EOF then
    exit for
    end if

    'Clean up.
    set fld = nothing
    set rs = nothing


    Any Ideas???

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Minneapolis, MN
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by gmatriix View Post
    Any Ideas???
    I would start by posting in a more appropriate forum. Moving to ASP…


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts