Printing Specific Records from Reports

G

Guest

Hello,

I have a report that details all activity at a specific site address. There
are some occasions when staff want to run the report for one specific date,
sometimes by a specific address only, or a group of addresses with different
account numbers as a group.

I have a print dialogue box with start and end dates on it and the base
report runs now by date. Can you advise how I set it up so that I can run a
group of non-consecutive numbers all at the same time i.e.
6143322008, 844344243, 144388000, etc.

Thx,
I
 
A

Allen Browne

In Word, the Print dialog allows you to print a range of pages, such as:
1, 34, 66-68, 88-
Sounds like you want to design an interface that works like that?

It can be done, but you will need program it, i.e. to build the Filter
string for the report. It has to be an expression that would work in the SQL
clause of a query. The output string for the example above would be:
(ClientID IN (1,34)) OR (ClientID Between 66 And 68) OR (ClientID >= 88)

Use Split() to parse the values into an array.
Use the IN operator for discrete values.
Use the Between operator for ranges.
If the field is non-numeric, don't forget to add the delimiters around the
values: quotes around values applied against a Text field, or # around date
values.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

in message
news:[email protected]...
 
G

Guest

Dear Allen,

Thank you, yes you are correct, that's exactly what I want to do. Okay,
I'll give it a try. I'm somewhat familiar with code. The report is already
built and the Print Dialogue Box is built, can you advise me where I should
be putting this to activate it so that they can use it.
Thank you,
I
 
A

Allen Browne

Presumably you have a button on your form, and clicking this button is
supposed to open the report and show the specified range of records?

If that's right, the code goes into the Click event procedure of the command
button. You must build the string in code, and use it as the WhereCondition
for OpenReport.

The link gives an example of building the string and opening the report. You
will need some understanding of VBA code to build the string.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

in message
 
G

Guest

Thank you Allen, I'll give it the old college try. And thank you for the
link it appears to be an excellent resource and I can't wait to go through it
but I don't see anything about building the string, can you point me in the
right direction so I know where to look.
Thank you for all your help, this is wonderful.
Regards,
I
 

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