Opening a form and setting filter

  • Thread starter Thread starter Smiller
  • Start date Start date
S

Smiller

This is an easy one for those who know!!!

I want to open a form and set a filter.

I have the following line as code:

DoCmd.OpenForm "SalesbyProductDetailedForm", , , "[Salesby
ProductDetailedForm]![ProductCode] = " & Me![ProductCode]

the problem is that the end of the statement
Me![ProductCode] needs to be enclosed in quotes to work
properly. how does this line need to be modified?

Thank you
 
DoCmd.OpenForm "SalesbyProductDetailedForm", , ,
"[SalesbyProductDetailedForm]![ProductCode] = '" & Me![ProductCode] & "'"

Notice the single-quote (apostrophe) before the first double-quote and
between the last pair of double-quotes. Single-quotes are enough to enclose
the string expression in your Where Condition statement.

Paul Johnson
Alexandria, VA
 
That is so close...but I'm getting an extra apace before
the Me![ProductCode] value. How do I get rid of it?

Thanks
-----Original Message-----
DoCmd.OpenForm "SalesbyProductDetailedForm", , ,
"[SalesbyProductDetailedForm]![ProductCode] = '" & Me! [ProductCode] & "'"

Notice the single-quote (apostrophe) before the first double-quote and
between the last pair of double-quotes. Single-quotes are enough to enclose
the string expression in your Where Condition statement.

Paul Johnson
Alexandria, VA

This is an easy one for those who know!!!

I want to open a form and set a filter.

I have the following line as code:

DoCmd.OpenForm "SalesbyProductDetailedForm", , , "[Salesby
ProductDetailedForm]![ProductCode] = " & Me! [ProductCode]

the problem is that the end of the statement
Me![ProductCode] needs to be enclosed in quotes to work
properly. how does this line need to be modified?

Thank you


.
 
GOT IT THANK YOU!!!
-----Original Message-----
That is so close...but I'm getting an extra apace before
the Me![ProductCode] value. How do I get rid of it?

Thanks
-----Original Message-----
DoCmd.OpenForm "SalesbyProductDetailedForm", , ,
"[SalesbyProductDetailedForm]![ProductCode] = '" & Me! [ProductCode] & "'"

Notice the single-quote (apostrophe) before the first double-quote and
between the last pair of double-quotes. Single-quotes are enough to enclose
the string expression in your Where Condition statement.

Paul Johnson
Alexandria, VA

DoCmd.OpenForm "SalesbyProductDetailedForm", , , "[Salesb y
ProductDetailedForm]![ProductCode] = " & Me! [ProductCode]

the problem is that the end of the statement
Me![ProductCode] needs to be enclosed in quotes to work
properly. how does this line need to be modified?

Thank you


.
.
 
Back
Top