Suggestions Please

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

I want to design a report that will have 5 numbers displayed across the
page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be written).

I'm thinking the easiest way to do this would be to have a single text
box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed somewhere to
"count" the number of calculations?
Should the text box control(s) have grow and/or shrink properties set to
true?

Any other suggestions on how to proceed with this would be appreciated.

Thanks,
Bernie
 
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5 columns by 45 rows
of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub
 
Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might also
like to have the values be text.
You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would like them
to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I guess
I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to have
ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting values
in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie
 
I still am very confused at the purpose of this "exercise". Let's try again.
Create a table of numbers [tblNums] with a single numeric field [Num]. Add
records with values 1 through 50. Then create a report with a Record Source
of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control source to
=DoCalc(). Make sure the width of the report is narrow and use the Page
Setup create 5 columns that display across then down.
 
You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as to why
you don't understand me.
I now realize that what's missing here is the Table containing the
numbers I want to print to the single text box.

Your original code will work for me, but it's not the way I want to do
it...for maintainability reasons (I may want to include text, have more
or fewer columns, include spaces between rows, and others than I can't
think of right now).

So now that I finally have it through my thick head that I need a table
for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to generate
new values from my Function DoCalc().
3. I want to "fill" the table with values from my Function DoCalc()
each time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it
necessary that the Table have a relationship with the other
fields/tables in the report?

I think if you show me how to get the values of DoCalc() into my new
table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




Duane Hookom said:
I still am very confused at the purpose of this "exercise". Let's try
again.
Create a table of numbers [tblNums] with a single numeric field [Num].
Add records with values 1 through 50. Then create a report with a
Record Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control source
to =DoCalc(). Make sure the width of the report is narrow and use the
Page Setup create 5 columns that display across then down.

--
Duane Hookom
MS Access MVP


bw said:
The numbers come from a Function. They are calculated. I might also
like to have the values be text.

Again, these values are calculated in a Function, and I would like
them to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I
guess I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to have
ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting
values in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie
 
Could you explain purpose of this and the code for DoCalc()? It seems to me
that DoCalc() will always return the same value each time it is run unless
you have some static variables or random calcs. Will the values returned
from DoCalc() vary?

--
Duane Hookom
MS Access MVP

bw said:
You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as to why
you don't understand me.
I now realize that what's missing here is the Table containing the numbers
I want to print to the single text box.

Your original code will work for me, but it's not the way I want to do
it...for maintainability reasons (I may want to include text, have more or
fewer columns, include spaces between rows, and others than I can't think
of right now).

So now that I finally have it through my thick head that I need a table
for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to generate new
values from my Function DoCalc().
3. I want to "fill" the table with values from my Function DoCalc() each
time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it necessary
that the Table have a relationship with the other fields/tables in the
report?

I think if you show me how to get the values of DoCalc() into my new
table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




Duane Hookom said:
I still am very confused at the purpose of this "exercise". Let's try
again.
Create a table of numbers [tblNums] with a single numeric field [Num].
Add records with values 1 through 50. Then create a report with a Record
Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control source to
=DoCalc(). Make sure the width of the report is narrow and use the Page
Setup create 5 columns that display across then down.

--
Duane Hookom
MS Access MVP


bw said:
Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might also
like to have the values be text.

You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would like them
to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I guess
I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to have
ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting values
in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5 columns by 45
rows of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub

--
Duane Hookom
MS Access MVP

I want to design a report that will have 5 numbers displayed across the
page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be written).

I'm thinking the easiest way to do this would be to have a single text
box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed somewhere
to "count" the number of calculations?
Should the text box control(s) have grow and/or shrink properties set
to true?

Any other suggestions on how to proceed with this would be
appreciated.

Thanks,
Bernie
 
Could you explain purpose of this and the code for DoCalc()?
No, the calculations and reasons for them are proprietary. This same
thing is currently being generated in an Excel Spreadsheet. I'm trying
to integrate this information along with a currently existing Access
Client Database.
It seems to me that DoCalc() will always return the same value each
time it is run unless you have some static variables or random calcs.
Yes, DoCalc() will be provided with a "method" and starting value, so
the values returned will always vary by client, "method" and starting
value.

I understand you wanting to know more in order to help me.
But at this point, I just need to know how to "fill" my table with the
values from the DoCalc Function. Where, and how is this done?
I'm sure things would work as I had envisioned with this knowledge.

Bernie




Duane Hookom said:
Could you explain purpose of this and the code for DoCalc()? It seems
to me that DoCalc() will always return the same value each time it is
run unless you have some static variables or random calcs. Will the
values returned from DoCalc() vary?

--
Duane Hookom
MS Access MVP

bw said:
You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as to
why you don't understand me.
I now realize that what's missing here is the Table containing the
numbers I want to print to the single text box.

Your original code will work for me, but it's not the way I want to
do it...for maintainability reasons (I may want to include text, have
more or fewer columns, include spaces between rows, and others than I
can't think of right now).

So now that I finally have it through my thick head that I need a
table for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to generate
new values from my Function DoCalc().
3. I want to "fill" the table with values from my Function DoCalc()
each time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it
necessary that the Table have a relationship with the other
fields/tables in the report?

I think if you show me how to get the values of DoCalc() into my new
table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




Duane Hookom said:
I still am very confused at the purpose of this "exercise". Let's try
again.
Create a table of numbers [tblNums] with a single numeric field
[Num]. Add records with values 1 through 50. Then create a report
with a Record Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control
source to =DoCalc(). Make sure the width of the report is narrow and
use the Page Setup create 5 columns that display across then down.

--
Duane Hookom
MS Access MVP


Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might
also like to have the values be text.

You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would like
them to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I
guess I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to
have ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting
values in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5 columns
by 45 rows of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub

--
Duane Hookom
MS Access MVP

I want to design a report that will have 5 numbers displayed
across the page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be
written).

I'm thinking the easiest way to do this would be to have a single
text box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed
somewhere to "count" the number of calculations?
Should the text box control(s) have grow and/or shrink properties
set to true?

Any other suggestions on how to proceed with this would be
appreciated.

Thanks,
Bernie
 
You can use the tblNums that I suggested and create a query like:

INSERT INTO tblNoNameGiven ( NoFieldNameGiven )
SELECT DoCalc() AS CalcVal
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

--
Duane Hookom
MS Access MVP


bw said:
Could you explain purpose of this and the code for DoCalc()?
No, the calculations and reasons for them are proprietary. This same
thing is currently being generated in an Excel Spreadsheet. I'm trying to
integrate this information along with a currently existing Access Client
Database.
It seems to me that DoCalc() will always return the same value each time
it is run unless you have some static variables or random calcs.
Yes, DoCalc() will be provided with a "method" and starting value, so the
values returned will always vary by client, "method" and starting value.

I understand you wanting to know more in order to help me.
But at this point, I just need to know how to "fill" my table with the
values from the DoCalc Function. Where, and how is this done?
I'm sure things would work as I had envisioned with this knowledge.

Bernie




Duane Hookom said:
Could you explain purpose of this and the code for DoCalc()? It seems to
me that DoCalc() will always return the same value each time it is run
unless you have some static variables or random calcs. Will the values
returned from DoCalc() vary?

--
Duane Hookom
MS Access MVP

bw said:
You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as to why
you don't understand me.
I now realize that what's missing here is the Table containing the
numbers I want to print to the single text box.

Your original code will work for me, but it's not the way I want to do
it...for maintainability reasons (I may want to include text, have more
or fewer columns, include spaces between rows, and others than I can't
think of right now).

So now that I finally have it through my thick head that I need a table
for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to generate
new values from my Function DoCalc().
3. I want to "fill" the table with values from my Function DoCalc()
each time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it
necessary that the Table have a relationship with the other
fields/tables in the report?

I think if you show me how to get the values of DoCalc() into my new
table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
I still am very confused at the purpose of this "exercise". Let's try
again.
Create a table of numbers [tblNums] with a single numeric field [Num].
Add records with values 1 through 50. Then create a report with a
Record Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control source
to =DoCalc(). Make sure the width of the report is narrow and use the
Page Setup create 5 columns that display across then down.

--
Duane Hookom
MS Access MVP


Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might also
like to have the values be text.

You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would like
them to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I
guess I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to have
ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting values
in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5 columns by
45 rows of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub

--
Duane Hookom
MS Access MVP

I want to design a report that will have 5 numbers displayed across
the page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be written).

I'm thinking the easiest way to do this would be to have a single
text box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed somewhere
to "count" the number of calculations?
Should the text box control(s) have grow and/or shrink properties
set to true?

Any other suggestions on how to proceed with this would be
appreciated.

Thanks,
Bernie
 
Things are beginning to fall into place.

I've spent all day looking at your original code to generate random
numbers and I'm learning.
I put a version of the code in the OnFormat event for the Detail
Section.
Go to File>Page Setup>Columns and I have Number of Columns = 1, Column
size = 7.5", and Height = 9".
The report is excellent! It adjust spacing between numbers as the size
(value) of the number changes, and inserts blank rows after every 5th
number.

My question:
When intNumPages is greater than 1, all the numbers print on top of each
other, on page 1.
How do I force a page break in code like this?
CODE:
intRows = 55 * intNumPages
intColumns = 5
intRowHeight = 1440 * 9 / intRows

Set rpt = Me
With rpt
.FontName = "Arial"
.FontSize = 10
End With
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
rpt.CurrentX = intColumn * intColWidth
rpt.CurrentY = intRow * intRowHeight
If intRow Mod 6 = 0 Then
rpt.Print ""
Else
Me.Print Format(DoCalc(), "### #### #### 0000")
End If
Next
Next

This turned out to be better for me than using the tables.
Thanks again,
Bernie



Duane Hookom said:
You can use the tblNums that I suggested and create a query like:

INSERT INTO tblNoNameGiven ( NoFieldNameGiven )
SELECT DoCalc() AS CalcVal
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

--
Duane Hookom
MS Access MVP


bw said:
Could you explain purpose of this and the code for DoCalc()?
No, the calculations and reasons for them are proprietary. This same
thing is currently being generated in an Excel Spreadsheet. I'm
trying to integrate this information along with a currently existing
Access Client Database.
It seems to me that DoCalc() will always return the same value each
time it is run unless you have some static variables or random calcs.
Yes, DoCalc() will be provided with a "method" and starting value, so
the values returned will always vary by client, "method" and starting
value.

I understand you wanting to know more in order to help me.
But at this point, I just need to know how to "fill" my table with
the values from the DoCalc Function. Where, and how is this done?
I'm sure things would work as I had envisioned with this knowledge.

Bernie




Duane Hookom said:
Could you explain purpose of this and the code for DoCalc()? It
seems to me that DoCalc() will always return the same value each
time it is run unless you have some static variables or random
calcs. Will the values returned from DoCalc() vary?

--
Duane Hookom
MS Access MVP

You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as
to why you don't understand me.
I now realize that what's missing here is the Table containing the
numbers I want to print to the single text box.

Your original code will work for me, but it's not the way I want to
do it...for maintainability reasons (I may want to include text,
have more or fewer columns, include spaces between rows, and others
than I can't think of right now).

So now that I finally have it through my thick head that I need a
table for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to
generate new values from my Function DoCalc().
3. I want to "fill" the table with values from my Function
DoCalc() each time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it
necessary that the Table have a relationship with the other
fields/tables in the report?

I think if you show me how to get the values of DoCalc() into my
new table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
I still am very confused at the purpose of this "exercise". Let's
try again.
Create a table of numbers [tblNums] with a single numeric field
[Num]. Add records with values 1 through 50. Then create a report
with a Record Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control
source to =DoCalc(). Make sure the width of the report is narrow
and use the Page Setup create 5 columns that display across then
down.

--
Duane Hookom
MS Access MVP


Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might
also like to have the values be text.

You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would
like them to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I
guess I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and
this works okay.

But, what I had in mind (as part of the learning process) was to
have ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting
values in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5
columns by 45 rows of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub

--
Duane Hookom
MS Access MVP

I want to design a report that will have 5 numbers displayed
across the page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be
written).

I'm thinking the easiest way to do this would be to have a
single text box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed
somewhere to "count" the number of calculations?
Should the text box control(s) have grow and/or shrink
properties set to true?

Any other suggestions on how to proceed with this would be
appreciated.

Thanks,
Bernie
 
I wouldn't attempt to create pages without binding the report to a record
source. If you need two pages, use a record source with two records.

--
Duane Hookom
MS Access MVP

bw said:
Things are beginning to fall into place.

I've spent all day looking at your original code to generate random
numbers and I'm learning.
I put a version of the code in the OnFormat event for the Detail Section.
Go to File>Page Setup>Columns and I have Number of Columns = 1, Column
size = 7.5", and Height = 9".
The report is excellent! It adjust spacing between numbers as the size
(value) of the number changes, and inserts blank rows after every 5th
number.

My question:
When intNumPages is greater than 1, all the numbers print on top of each
other, on page 1.
How do I force a page break in code like this?
CODE:
intRows = 55 * intNumPages
intColumns = 5
intRowHeight = 1440 * 9 / intRows

Set rpt = Me
With rpt
.FontName = "Arial"
.FontSize = 10
End With
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
rpt.CurrentX = intColumn * intColWidth
rpt.CurrentY = intRow * intRowHeight
If intRow Mod 6 = 0 Then
rpt.Print ""
Else
Me.Print Format(DoCalc(), "### #### #### 0000")
End If
Next
Next

This turned out to be better for me than using the tables.
Thanks again,
Bernie



Duane Hookom said:
You can use the tblNums that I suggested and create a query like:

INSERT INTO tblNoNameGiven ( NoFieldNameGiven )
SELECT DoCalc() AS CalcVal
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

--
Duane Hookom
MS Access MVP


bw said:
Could you explain purpose of this and the code for DoCalc()?
No, the calculations and reasons for them are proprietary. This same
thing is currently being generated in an Excel Spreadsheet. I'm trying
to integrate this information along with a currently existing Access
Client Database.

It seems to me that DoCalc() will always return the same value each time
it is run unless you have some static variables or random calcs.
Yes, DoCalc() will be provided with a "method" and starting value, so
the values returned will always vary by client, "method" and starting
value.

I understand you wanting to know more in order to help me.
But at this point, I just need to know how to "fill" my table with the
values from the DoCalc Function. Where, and how is this done?
I'm sure things would work as I had envisioned with this knowledge.

Bernie




"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Could you explain purpose of this and the code for DoCalc()? It seems
to me that DoCalc() will always return the same value each time it is
run unless you have some static variables or random calcs. Will the
values returned from DoCalc() vary?

--
Duane Hookom
MS Access MVP

You're confused? Try being in my shoes :)

I think I'm beginning to understand my problem, and also maybe as to
why you don't understand me.
I now realize that what's missing here is the Table containing the
numbers I want to print to the single text box.

Your original code will work for me, but it's not the way I want to do
it...for maintainability reasons (I may want to include text, have
more or fewer columns, include spaces between rows, and others than I
can't think of right now).

So now that I finally have it through my thick head that I need a
table for the numbers, I will proceed as follows:
1. I will use a Delete Query each time the report is run to delete
previous values, and begin anew.
2. I will use a Create Query each time the report is run to generate
new values from my Function DoCalc().
3. I want to "fill" the table with values from my Function DoCalc()
each time the report is run. How is this done?
4. Since I always have a starting value for my Function, is it
necessary that the Table have a relationship with the other
fields/tables in the report?

I think if you show me how to get the values of DoCalc() into my new
table, I'll be ready to proceed.

Again, I appreciate your help Duane.
Bernie




"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
I still am very confused at the purpose of this "exercise". Let's try
again.
Create a table of numbers [tblNums] with a single numeric field
[Num]. Add records with values 1 through 50. Then create a report
with a Record Source of

SELECT tblNums.Num, tblNums_1.Num
FROM tblNums, tblNums AS tblNums_1
WHERE (((tblNums.Num)<=45) AND ((tblNums_1.Num)<=5));

Add a single text box to the detail section and set its control
source to =DoCalc(). Make sure the width of the report is narrow and
use the Page Setup create 5 columns that display across then down.

--
Duane Hookom
MS Access MVP


Where do the numbers come from? Are they random?
The numbers come from a Function. They are calculated. I might
also like to have the values be text.

You mention "page" 3 times and never mention fields or tables
Again, these values are calculated in a Function, and I would like
them to be numbers and/or text.

You code is really appreciated!!!
I "think" I understand it, but I'm not sure it is what I want...I
guess I can make it work.
I replaced your code with a call to my Function as follows:
Me.Print Format(Rnd() * 1000, "#.00")
Me.Print Format(DoCalc(),"### #### 0000") ... and this
works okay.

But, what I had in mind (as part of the learning process) was to
have ONE Unbound control with a control source of: =DoCalc()
In Page Setup, I would specify 5 columns, and then keep putting
values in the one Unbound control to print all 5x45 values.

Can it be done this way? Should it be done this way?

Thanks for your help Duane.
Bernie


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
Where do the numbers come from? Are they random?
You mention "page" 3 times and never mention fields or tables.

This code in the On Page event of the report will print 5 columns
by 45 rows of numbers.

Private Sub Report_Page()
'code to print 5 columns by 45 rows of random numbers
' on a page
'
Dim intColumn As Integer
Dim intColWidth As Integer
Dim intRow As Integer
Dim intRowHeight As Integer
Dim intRows As Integer
Dim intColumns As Integer
intRows = 45
intColumns = 5
intColWidth = Me.Width / intColumns
intRowHeight = 1440 * 9 / intRows
Randomize
For intRow = 0 To intRows - 1
For intColumn = 0 To intColumns - 1
Me.CurrentX = intColumn * intColWidth
Me.CurrentY = intRow * intRowHeight
Me.Print Format(Rnd() * 1000, "#.00")
Next
Next
End Sub

--
Duane Hookom
MS Access MVP

I want to design a report that will have 5 numbers displayed across
the page, and 45 numbers displayed down the page.
The numbers will be calculated via a Function (yet to be written).

I'm thinking the easiest way to do this would be to have a single
text box that calls the Function.
The report would have 5 columns (I'm guessing).

How do I call the Function 5x45 times for a single page?
How do I get the value of the Function in the text box(s).
How many text boxes should I have?
Is there code outside the Function that needs to be placed
somewhere to "count" the number of calculations?
Should the text box control(s) have grow and/or shrink properties
set to true?

Any other suggestions on how to proceed with this would be
appreciated.

Thanks,
Bernie
 
Back
Top