create a report using vba to select the names for the report

Hi,
I need to create a report of selected Customers, I have gone as far as
creating a string with customer names in it. Whats next?

sample = 

Selected_Customer_Names= [ABC], [test], [New], [A New One] ...... and so on.

Is this correct for the report and/or how do i open the report with the above
only listed?

-- 
Message posted via http://www.accessmonster.com

0
trevorC
4/28/2010 3:47:34 AM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
1645 Views

Similar Articles

[PageSpeed] 0

On Wed, 28 Apr 2010 03:47:34 GMT, "trevorC via AccessMonster.com" <u44860@uwe>
wrote:

>Hi,
>I need to create a report of selected Customers, I have gone as far as
>creating a string with customer names in it. Whats next?
>
>sample = 
>
>Selected_Customer_Names= [ABC], [test], [New], [A New One] ...... and so on.
>
>Is this correct for the report and/or how do i open the report with the above
>only listed?

square brackets delimit field or control names. This list won't do what you
want. If you have customers ABC, Test, New and so on; and these names are
unique (names rarely are, I know three guys named Fred Brown), then you could
use a string with the names in doublquotes:

 "ABC", "test", "New", "A New One"

and use this string in the WhereCondition argument of the OpenReport action:

DoCmd.OpenReport "MyReport", WhereCondition := "[CustomerName] IN (" _ 
  & Selected_Customer_Names & ")"

But I suspect there are better ways to go about it if you would care to post
some information about your table structures and the context in which you're
doing this.
-- 

             John W. Vinson [MVP]
0
John
4/28/2010 4:11:52 AM
Reply:

Similar Artilces: