Looping through records via a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a form that contains three fields per record, the fields are:

[CUSTREF]
[CUSTNAME]
[BALANCE]

They basically show those customers that have a balance of >0 from the
underlying table.

I have a report that is in the format of a customer statement that links the
table from the form above with the customer master file.

What I need to do, is from a button on another form (like a control panel)
is open the form detailed above and basically scroll through each record,
opening the statement report on each record and printing it. I have written
the code to open the report based on the selected record and print it and
close. But I cannot return to the form and move to the next record to repeat
the process. I would also like it to stop after the last record and close
down.

Can anyone help?
 
K,
Let's just work with the form (and that recordset) and the report for now. I don't
think, from what I understand about what you're doing, the intermediate ("Control Panel")
form is necessary right now.
Are you saying that the form recordset contains only clients with balance >0, but that
you don't want to print them all? In other words, you'll move through a few records, do a
print of that record, move through a few more, print that one etc.. etc..
If so, then we'll handle that in a different method.

OR...
You would like to print a statement for each record in the form's recordset? I'll
assume this is the case...
The query that delivers the records for your form can be used as the query for the
report. You just have to design the report so that only one statement prints per page.
(For example, placing a PageBreak just after the detail section of your statement.)
Instead of printing each record individually, the report can print them all (one
statement per page) all in one go.
--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Hi Al,
Apologies for the delay in replying to you but I have not been in the office
since this post!

Yes, I understand your method here, the query does produce those records
that have a balance of >0 and that query is the query that the report is
based upon.

So what I need to do is ensure that the report is opened and each record is
printed, by means of a page break as you have suggested. That is the part
that I need help on with the settings of the detail section of the report.

Thanks
--
K Hogwood-Thompson


Al Campagna said:
K,
Let's just work with the form (and that recordset) and the report for now. I don't
think, from what I understand about what you're doing, the intermediate ("Control Panel")
form is necessary right now.
Are you saying that the form recordset contains only clients with balance >0, but that
you don't want to print them all? In other words, you'll move through a few records, do a
print of that record, move through a few more, print that one etc.. etc..
If so, then we'll handle that in a different method.

OR...
You would like to print a statement for each record in the form's recordset? I'll
assume this is the case...
The query that delivers the records for your form can be used as the query for the
report. You just have to design the report so that only one statement prints per page.
(For example, placing a PageBreak just after the detail section of your statement.)
Instead of printing each record individually, the report can print them all (one
statement per page) all in one go.
--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

KHogwood-Thompson said:
Hi,

I have a form that contains three fields per record, the fields are:

[CUSTREF]
[CUSTNAME]
[BALANCE]

They basically show those customers that have a balance of >0 from the
underlying table.

I have a report that is in the format of a customer statement that links the
table from the form above with the customer master file.

What I need to do, is from a button on another form (like a control panel)
is open the form detailed above and basically scroll through each record,
opening the statement report on each record and printing it. I have written
the code to open the report based on the selected record and print it and
close. But I cannot return to the form and move to the next record to repeat
the process. I would also like it to stop after the last record and close
down.

Can anyone help?
 
Without seeing the report, that's pretty difficult to say exactly.
Looks like all you data is One to One (only one record per Cust delivered to the report...
perhaps a Totals query?)

Sorting & Grouping setup... Since there is only ONE Name for each CustRef, we can sort by
CustName, then CustRef...
CustName Asc
CustRef Asc Header and Footer visible = Yes

CustRef Group Header -------------------------------
Detail -------------------------------------------------
[CUSTREF]
[CUSTNAME]
[BALANCE]
CustRef Group Footer-------------------------------
Page Break
-------------------------------------------------------
Does that help?
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

KHogwood-Thompson said:
Hi Al,
Apologies for the delay in replying to you but I have not been in the office
since this post!

Yes, I understand your method here, the query does produce those records
that have a balance of >0 and that query is the query that the report is
based upon.

So what I need to do is ensure that the report is opened and each record is
printed, by means of a page break as you have suggested. That is the part
that I need help on with the settings of the detail section of the report.

Thanks
--
K Hogwood-Thompson


Al Campagna said:
K,
Let's just work with the form (and that recordset) and the report for now. I don't
think, from what I understand about what you're doing, the intermediate ("Control
Panel")
form is necessary right now.
Are you saying that the form recordset contains only clients with balance >0, but
that
you don't want to print them all? In other words, you'll move through a few records,
do a
print of that record, move through a few more, print that one etc.. etc..
If so, then we'll handle that in a different method.

OR...
You would like to print a statement for each record in the form's recordset? I'll
assume this is the case...
The query that delivers the records for your form can be used as the query for the
report. You just have to design the report so that only one statement prints per page.
(For example, placing a PageBreak just after the detail section of your statement.)
Instead of printing each record individually, the report can print them all (one
statement per page) all in one go.
--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

KHogwood-Thompson said:
Hi,

I have a form that contains three fields per record, the fields are:

[CUSTREF]
[CUSTNAME]
[BALANCE]

They basically show those customers that have a balance of >0 from the
underlying table.

I have a report that is in the format of a customer statement that links the
table from the form above with the customer master file.

What I need to do, is from a button on another form (like a control panel)
is open the form detailed above and basically scroll through each record,
opening the statement report on each record and printing it. I have written
the code to open the report based on the selected record and print it and
close. But I cannot return to the form and move to the next record to repeat
the process. I would also like it to stop after the last record and close
down.

Can anyone help?
 

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

Back
Top