View Full Version : Search Code???

12-05-2007, 07:38 PM
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???

12-05-2007, 08:11 PM
Any Ideas???

I would start by posting in a more appropriate forum. Moving to ASPů