No, I don't. Just looking at the logic, you added a boolean variable, but I don't see this var helping in "bookmarking" the first found record. "exit for" doesn't depend on the value of IsFound.
I tried your solutions anyhow. However, my ASP/HTML knowledge is extremely limited. So I added a line to display the cust_num of the found record as in the code below bu there is an error that I don't know how to debug.
Any further help is greatly appreciated.
dim i
dim rs
dim fld
dim FieldCount
dim IsFound
IsFound = False
FieldCount = MSODSC.DefaultRecordset.Fi
set rs = MSODSC.DefaultRecordset
for i = 0 to FieldCount - 1
set fld = rs.Fields(i)
rs.Find name & " = '" & txtSearch.value & "*'", 0, 1, 1
if rs.EOF then
rs.MoveFirst
else
IsFound = True
exit for
end if
next
txtcust_num.value = rs!cust_num 'THERE IS AN ERROR HERE...NOT COMPILED
set fld = Nothing
set rs = Nothing
Main Topics
Browse All Topics





by: routinetPosted on 2005-09-22 at 06:50:19ID: 14936617
You'll also want this:
Dim IsFound As Boolean
IsFound = False
In the loop, when you have found a record:
if rs.EOF then
rs.MoveFirst
else
'HOW TO SHOW THE FIRST MATCHING RECORD ON THE FORM (I MEAN THE DATA ACCESS PAGE)???
IsFound = True
exit for
end if
Just outside the loop (right after 'Next'):
' Current record has your information...use html/asp to put out the values
%>
MyField1 = <%= rs!MyField1 %>
etc...
<%
set fld = Nothing
set rs = Nothing
%>
Understand?