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

Filtering Continueous Forms 1

Status
Not open for further replies.

dendic

Programmer
Jan 19, 2003
106
US
I'm attempting to use this code but can't get it to work.
Dim varConsignee as string
varConsignee = Me.Combo15
DoCmd.ApplyFilter , "Consigneename = varConsignee"

I also tried.
Me.Filter = "Consigneename = varconsignee"
Me.FilterOn = True
 
dendic,
Code:
Me.Filter = "Consigneename = '" & varconsignee & "'"
Me.FilterOn = True

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
or if your into built in functions
Code:
Me.Filter = BuildCriteria("Consigneename", dbText, "=" & varConsignee)

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
I have one more problem when varcConsignee has a period in the name I get an error about "invalid Dot or invalid ! or invalid parenthesis".
 
Perhaps this ?
Me.Filter = "Consigneename = [tt]'"[/tt] & Replace(varconsignee, [tt]"'", "''") & "'"[/tt]
Me .FilterOn = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top