Jumat, 07 November 2014

Re: [MS_AccessPros] Re: Filtering records using two criteria

 

John-


This would have been easier if you had included my reply.  I went and found my previous answer on the group website.  Here it is again:

  Me.Filter = "ReviewAssignedTo = '" & Me.cboReviewAssignedTo & _
     "' AND ReviewedMRR = False"

Because ReviewAssignedTo is a Text field, any literal for comparison in a predicate must also be text enclosed in quotes.  I used double quotes to surround my string, so I used a single quote inside that string to start the embedded text literal.  & Me.cboReviewAssignedTo includes the value from your form, and that gets concatenated with a terminating single quote and the rest of the predicate.  Let's assume cboReviewAssignedTo has John Fakes in it.  When fully evaluated, the Filter gets set to:

ReviewAssignedTo = 'John Fakes' AND ReviewedMRR = False

Does that help explain it?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Nov 7, 2014, at 3:47 PM, jfakes@rocketmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John V,

That worked.  I tried something like that however, I didn't have the quotes correct.  Can you explain what the " ' means infront of the AND?  Looking at the code, it looks like it must have something to do with it being a command as there isn't a "closing" '.

 

Thanks, I spent several hours trying to figure this out. 

 

John


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar