Sorry, I tried to boil the program down to the simplest terms in order to get
my point across about what I am trying to accomplish. I guess that I boiled
it too long. Each time I go to do a report, the Date and Number-of-Times
will vary, so that is why I am referring to your table (tblNumbers) as a
temporary table. It will have to be erased and recreated each time. Thanks
for the pointer to AB, I'll check there.
:
What makes you think I am asking you to create a temporary table? The
tblNumbers is a permanent table with just a single field and some records.
You don't need to write any code for this to work.
If you still don't understand, take a look at Allen Browne's page
http://www.allenbrowne.com/ser-39.html. He provides more complete
documentation on this solution.
--
Duane Hookom
Microsoft Access MVP
:
Thanks Duane, but if you read my original question, you'd see that the last
thing I specified was to NOT have to create a temporary table, which is
exactly what you are telling me to do. What I'm looking for is a VB command
such as me.print that will print the detail line, let me change it, and then
print it again with the changes as many times as needed. I'm already doing
it using a form and a button to call a VB script that deletes the data from
the temp table and then adds the new records and finally calls the report
that uses the data from the temp table. What I was looking for was a way to
do it in one step within the report itself.
:
I would create a table of numbers [tblNumbers] with a single, numeric field
[Num] and enter values 0,1,2,3,...x.
You can then add this table to your report's record source query and set the
criteria under the [Num] column to <=TNumber. Create another column in the
query like:
TheDates: TDate + [Num]
This should create multiple records with the correct dates.
--
Duane Hookom
Microsoft Access MVP
:
For a scheduling program, I have a detail record with a date field (TDate),
Amount, and integer field (TNumber). On a report I need to print the detail
Tnumber times, incrementing the TDate by one each time:
[Detail Section]
Tdate Amount
Tdate+1 Amount
Tdate+2 Amount
etc
I tried using undefined variables and a For-Next Loop, but it only prints
the last value it calculates.
Private Sub Detail_Format(...)
Dim i as integer
for i=1 to me.tnumber
me.PrintDate=me.Tdate-1+i
me.PrintAmount=me.amount
me.print
next i
I'm open to suggestions, short of making a temporary table.
thanks.