PDA

Click to See Complete Forum and Search --> : URGENT SEARCH


darylcollins@op2.co.uk
Apr 11th, 2000, 07:24 PM
Can anyone help using the below code on button click, if it does not find a record it will show me a blank record, how would I let the user know the search criteria was not found and then move to the first record.


<CODE?
lastposition = Trim(InputBox("Enter Company for search."))
criteria = "COMP_NAME Like '" & lastposition & "%'"
frmCompany.rsmaster.Find criteria


thank you in advance
Daryl

Jaguar
Apr 12th, 2000, 02:57 AM
Dim varLastRecordBM as variant ' BookMark
Dim lngIDToFind as variant
TryAgain:
lngIDToFind = Inputbox("RecordID to find?")

if Len(lngIDToFind) = 0 then Exit Sub
if Not IsNumeric(lngIDToFind) then
msgbox "You must supply a number.", vbinformation
Goto TryAgain
end if
lngIDToFind = clng(lngIDToFind)

varLastRecordBM = ors.BookMark
ors.Find "ID=" & lngIDToFind
If ors.EOF Then
msgbox "ID not found.", vbinformation
ors.BookMark = varLastRecordBM ' or ors.movefirst
else
' msgbox "ID found.", vbinformation
...
End If

Hope this helps.