260 pts.
0
Q:
VB6.0_Filter_Find_Code
Hi Expers

In VB 6.0

Please Provide code concept with easy examples for Filter and Find (I using DataEnvironment on Desine Form for eg. DataEnvironment.RsEmp.Update etc


Thanks
Anand
ASKED: Nov 21 2008  6:22 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
85 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
the below code will check the table for the employee number(text1.text) I assumed the first field in the table is empno.

DataEnvironment.RsEmp.movefirst
a = 1
while DataEnvironment.RsEmp.EOF = false

if DataEnvironment.RsEmp.fields(0) = text1.text then
msgbox("Empno found")
a= 0
exit do
else
DataEnvironment.RsEmp.movenext
end if

wend

if a = 1 then
msgbox("Empno not found")
end if

Instead coding like this we can use

DataEnvironment.RsEmp.find "emp_no= '"+text1.text+"'"


text2.text = DataEnvironment.RsEmp.fields(1)
text3.text = DataEnvironment.RsEmp.fields(2)
You can get the record information as above

Filter
DataEnvironment.RsEmp.find "dept= '"+text1.text+"'"

It will position to the first record of dept = text1.text
We can move to the records matching by giving

DataEnvironment.RsEmp.movenext
Last Answered: Nov 21 2008  8:06 AM GMT by Try it   85 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0