VB6.0_Filter_Find_Code

280 pts.
Tags:
DataEnvironment
VB
Visual Basic 6
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following