Opening a form and setting filter

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
 
P

Paul Johnson

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
 
S

smiller

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


.
 
S

smiller

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


.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top