From: Silvio on
Hello, I have a macro that open and filter a form based on two conditions:
CustomerID and ProgramID. However, it does not filter as intended. I most
likely I am missing something when concatenating the two conditions, any idea?

="[Customer_ID]=" & [CustomerID] And "[Program_ID]=" & [ProgramID]


P.S. CustomerID and ProgramID are both numeric.

Thank you,
Silvio
From: DrGUI on
Place an ampersand and the double quote before the ' And'. See below:


= "[Customer_ID]=" & [CustomerID] & " And [Program_ID]=" & [ProgramID]




"Silvio" wrote:

> Hello, I have a macro that open and filter a form based on two conditions:
> CustomerID and ProgramID. However, it does not filter as intended. I most
> likely I am missing something when concatenating the two conditions, any idea?
>
> ="[Customer_ID]=" & [CustomerID] And "[Program_ID]=" & [ProgramID]
>
>
> P.S. CustomerID and ProgramID are both numeric.
>
> Thank you,
> Silvio
From: Mike Painter on
Silvio wrote:
> Hello, I have a macro that open and filter a form based on two
> conditions: CustomerID and ProgramID. However, it does not filter as
> intended. I most likely I am missing something when concatenating the
> two conditions, any idea?
>
> ="[Customer_ID]=" & [CustomerID] And "[Program_ID]=" & [ProgramID]
>
="[Customer_ID]=" & [CustomerID] & " And [Program_ID]=" & [ProgramID]


From: Silvio on
Thank you folks, this is working great! I hope one day to fully understand
the quotation mark logic :-)

"Mike Painter" wrote:

> Silvio wrote:
> > Hello, I have a macro that open and filter a form based on two
> > conditions: CustomerID and ProgramID. However, it does not filter as
> > intended. I most likely I am missing something when concatenating the
> > two conditions, any idea?
> >
> > ="[Customer_ID]=" & [CustomerID] And "[Program_ID]=" & [ProgramID]
> >
> ="[Customer_ID]=" & [CustomerID] & " And [Program_ID]=" & [ProgramID]
>
>
> .
>
From: Mike Painter on
Silvio wrote:
> Thank you folks, this is working great! I hope one day to fully
> understand the quotation mark logic :-)
>
> "Mike Painter" wrote:
>
>> Silvio wrote:
>>> Hello, I have a macro that open and filter a form based on two
>>> conditions: CustomerID and ProgramID. However, it does not filter as
>>> intended. I most likely I am missing something when concatenating
>>> the two conditions, any idea?
>>>
>>> ="[Customer_ID]=" & [CustomerID] And "[Program_ID]=" & [ProgramID]
>>>
>> ="[Customer_ID]=" & [CustomerID] & " And [Program_ID]=" &
>> [ProgramID]
>>
If I have a line like that in a code block I will usually pop it up in a
msgbox to see if it looks right.




 | 
Pages: 1
Prev: Create Table
Next: Text box and "Enter"