Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose we have an Access 2010 form that allows a user to navigate over every single employee in the table Employees.

Suppose also the form contains a TextBox txtId where the user can type the Id that uniquely identifies an employee. After clicking a button OK the form should show the information related to the employee identified by the typed id.

How can I do that using VB6 and without using filters?

I'd like the same effect the macro SearchForRecord has but doing all the work from Visual Basic.

Thank you in advance.
Posted

1 solution

An Access form has a Filter and an FilterON property. Just need to set the FilterOn to True and the Filter property to the text as would appear in a SQL Where clause (ie, Company LIKE "C*").

Me.Filter = "Company LIKE """ + CompanyFilter.Text + """"
Me.FilterOn = True


This should also work fine when form only shows a single record, or when it shows many records.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900