Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data filter 1

Status
Not open for further replies.

fourofclubs

Programmer
May 13, 2003
18
0
0
CA
This should (in theory) be pretty simple, but as of yet, I've had no luck. I'm just trying to filter the records in a data control. I've tried using the filter property of the recordset, but this doesn't seem to do anything (and I haven't found an applyfilter method or anything resembling one. I've tried requerying the recordset and refreshing the data. I've also tried altering the recordsource, but to no avail.
Any help would of course be much appreciated.

Brad.
 
Hi Brad,
There are 2 ways of doing filtering.
1) when you are doing your select statement, do not include that field.
2) your sql should be something like this .recordset.filter="value". I am not very sure of the codes as i have not touch VB and SQL for some time

Good luck
 
I thank you for responding. I beleive I've tried what you're suggesting however. This is the code I'm using.

Code:
datActivities.Recordset.Filter = "[Project Number] = " _
  & datProjects.Recordset![tblMainProject.Project Number]
datActivities.Recordset.Requery
datActivities.Refresh

I've got two data controls on the form, datActivities, and datProjects. What I'd like is for the activities data to be filtered according to the projects data. Right now this really does nothing (noticable, anyway). Again, any help would be much appreciated.

Brad.
 
I believe you are using DAO?

Then do this:

datActivities.Recordset.Filter = "[Project Number] = " _
& datProjects.Recordset![tblMainProject.Project Number]

Set datActivities.Recordset = datActivities.Recordset.OpenRecordset

Do not requery or refresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top