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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with Apply Filter Syntax

Status
Not open for further replies.

kopy

Technical User
May 30, 2002
141
US
I'm stuck on the syntax for my ApplyFilter code. At this point it doesn't bring up any records. Tanks in advance for any help, Kopy

Here's my code:

Dim stDocName As String
Dim stLinkCriteria As String
Dim FindFamilyID As Variant

FindFamilyID = (IIf(Len([SubjectID]) = 6, Mid([SubjectID], 1, 4), IIf(Len([SubjectID]) = 5, Mid([SubjectID], 1, 3), IIf(Len([SubjectID]) = 4, Mid([SubjectID], 1, 2), Mid([SubjectID], 1, 2)))))

stDocName = "fromSiblingsNotBeingPrescreened"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.ApplyFilter , "[FamilyID] ='" & FindFamilyID & "'"
 
This would be easier:

Code:
FindFamilyID = Mid([SubjectID], 1, Len([SubjectID]-2))

Why do you wish to apply a filter rather than opening the form to only include the relevant records? Is FamilyID text or numeric?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top