Question

Asked:
Asked By:
Nov 21 2008   6:22 AM GMT
AnandaDebnath   240 pts.

VB6.0_Filter_Find_Code


VB, Visual Basic 6, VB 6, DataEnvironment

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

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



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
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register