applyfilter with a wildcard

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two fields on my form to filter the underlying dataset, Branch and
Position. I'm trying to use the ApplyFilter method to filter my dataset
instead of using the query itself. The problem happens when one or both
field is blank. The filter looks for records with blank Branches and or
Positions. I know in a query you would use the "Like [Field] & *" technique.
This way if your filed is blank you get all records. How do I do this in
VBA?

Private Sub Branch_AfterUpdate()

Dim stLinkCriteria As String

stLinkCriteria = "[Name] & [Description]=" & "'" & Me![Branch] & "'"

DoCmd.ApplyFilter , stLinkCriteria

'Like Me![Branch] & "*"
'Like Me![ Position] & "*"

End Sub
 
stLinkCriteria = "[Name] & [Description] Like "'" & Me![Branch] & "*'"

However, I don't really understand the [Name] & [Description] part on your
part...
 
Back
Top