473,511 Members | 15,364 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using a report multiple times

I have table of customer information. For each record in the
table, I'd like to output it to Snapshot passing in a report
as the type. I'd like to use the same report for every customer.
The problem I'm having in my VB code is that when I loop through
the records and output the report to Snapshot, the information
in the report remains to be the first record. When outputting
the report, it doesn't move to the next record.

I'm new to Access, and I'm not sure as to what I need
for the report to recognize the current record. I've looked in
the newsgroup, but have tried everything from refreshing
to requery, opening the report, closing it. I don't
think I know where I need to put it, or fully
understand how reports work. My VB code
does get input from user. Can any one help?

Here is a sample pseudocode:

Set db = Currendb()
Set rs = db.OpenRecordset ()

While not rs.EOF
DoCmd.Outputto acReport,reportname,acFormatSNP,dir,false
rs.Movenext

End

Thank you,
Nhien

Nov 13 '05 #1
3 1642
Nhien,
you never filter the report!!! Granted, this is probably ugly, but it
should work.

Public Sub OutputReportsToRTF()

Set rs = DBEngine(0)(0).QueryDefs("qryCustomer_A").OpenReco rdset

While Not rs.EOF
DoCmd.OpenReport "Invoice", acViewPreview, , "[CustomerID]=" &
rs.Fields("CustomerID")
DoCmd.OutputTo acReport, "Invoice", acFormatSNP, "rpt" &
rs.Fields("CustomerID") & ".snp", False
DoCmd.Close acReport, "Invoice", acSaveNo
rs.MoveNext
Wend

rs.Close
Set rs = Nothing

End Sub

Nov 13 '05 #2
Nhien,
you never filter the report!!! Granted, this is probably ugly, but it
should work.

Public Sub OutputReportsToRTF()
'this is my query that retrieves the CustomerID's that I want to create
invoices for...
Set rs = DBEngine(0)(0).QueryDefs("qryCustomer_A").OpenReco rdset

'passing the individual customerID's to the OpenReport command so 'I
get a single report per customer. (not one with multiple customers)
While Not rs.EOF
DoCmd.OpenReport "Invoice", acViewPreview, , "[CustomerID]=" &
rs.Fields("CustomerID")

'--output said report
DoCmd.OutputTo acReport, "Invoice", acFormatSNP, "rpt" &
rs.Fields("CustomerID") & ".snp", False
DoCmd.Close acReport, "Invoice", acSaveNo
rs.MoveNext
Wend

rs.Close
Set rs = Nothing

End Sub

Nov 13 '05 #3
Thank you all for your help. The suggestions
worked and I will remember to filter a
report next time.

-Nhien

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2068
by: dixie | last post by:
I have a report which is printed daily. It is a list of people. A person can be put on this list for one day, which is easyily achieved from a simple form. My problem is that a person can also...
2
2091
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
2
2079
by: (Pete Cresswell) | last post by:
I have a situation where a bunch of statistics are being presented based on a mutual fund and a benchmark fund's monthly and quarterly returns for a given period (like 10 years....) The hitch...
2
3094
by: Alpha | last post by:
I have a C# program that user would select several search criteria and then outputs to the Crystal Report. A message is output to user if no matching record is found. In my code I also clear,...
3
7682
by: sara | last post by:
I've been reading all the posts on this topic. Most are years old, so I have 2 questions: 1. Is there any improvement on opening the same report multiple times (with different input parameters...
2
2869
by: B Garner | last post by:
Hi all Help please. I would like to automate the printing of a report. The report actually is a single page and prints a label. I would like to be able to print the report multiple times...
4
5947
by: mehrhardt | last post by:
My situtation: I'm not very good at Access. I've created a report (R_SalesHist) listing 1000 customers sales history. Each customer's sales history fits nicely on a single page. When I run...
5
3937
prn
by: prn | last post by:
Hi folks, I'm looking for a little advice here. I need to create a report that is totals only, with no detail records. I have a database with a lot of individuals (people) and the report has to...
2
2381
by: awojciehowski | last post by:
Can any one point me in the right direction here... I have a report that shows an entry and under that record there are several sub records...best way to explain it is imagine an order with...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7353
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.