Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2011, 06:23 AM
Authorized User
 
Join Date: Jul 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using IN syntax in a Filter

Hello there!

The following code works fine

G_StrWhere = "[Group]=" & G_Group_Code & " AND " & "[EntryDate]=" & SQLDate(G_Greg_Date)

Me.Filter = G_StrWhere
Me.FilterOn = True

I would like to get 2 Groups together in the first part using the syntax " IN"
e.g. (4,6 IN G_Group_Code)
Anyone knows how to do it?

Thanks

 
Old October 31st, 2011, 10:58 AM
JP JP is offline
Authorized User
 
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If you want your filter to return only where [Group] equals 4 or 6, wouldn't the syntax be

Code:
"[Group]= IN(4,6)" & " AND " & "[EntryDate]=" & SQLDate(G_Greg_Date)
__________________
Regards,
JP
JP SoftTech
 
Old October 31st, 2011, 12:47 PM
Authorized User
 
Join Date: Jul 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using IN syntax in a Filter

I get a Run-time error 3075 missing operator
 
Old October 31st, 2011, 01:30 PM
Authorized User
 
Join Date: Jul 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Using IN syntax in a Filter

I have found the problem.

"[Group]= IN(4,6)" & " AND " & "[EntryDate]=" & SQLDate(G_Greg_Date) - Error


"[Group] IN(4,6)" & " AND " & "[EntryDate]=" & SQLDate(G_Greg_Date) - Correct

The equal sign shuldn't be there.

Thanks for all the help
 
Old October 31st, 2011, 02:52 PM
JP JP is offline
Authorized User
 
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts
Default

LOL that's what I meant
__________________
Regards,
JP
JP SoftTech





Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath query (filter) syntax problem? tclotworthy XSLT 4 February 1st, 2011 11:57 AM
Filter on Certain dates DianaTokatlidis Access 5 October 22nd, 2007 09:56 AM
folder filter keyvanjan Classic ASP Professional 1 November 30th, 2005 06:39 AM
Filter Help mcloum Classic ASP Databases 2 November 10th, 2005 05:40 PM
Filter Help mcloum BOOK: Beginning ASP 3.0 1 August 26th, 2005 03:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.