how to - reports & vba arrays

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

Greetings:

I have a form for user input and some tables that have
static data. I am using a procedure that combines the
user input with data in formulas. There is For...Next
structure with a majority of the arguments being arrays
(one dimensional).

Currently I dump these arrayed arguments into "tblTEMP"
and use this table as a basis for a report. I am
utilizing a 'delete query' to "clean the table".

Question - is there a way to have the report obtain
arrayed arguments from vba ? if so how ?


Thank you in advance for taking the time to answer this
question.


Todd
 
Todd said:
Greetings:

I have a form for user input and some tables that have
static data. I am using a procedure that combines the
user input with data in formulas. There is For...Next
structure with a majority of the arguments being arrays
(one dimensional).

Currently I dump these arrayed arguments into "tblTEMP"
and use this table as a basis for a report. I am
utilizing a 'delete query' to "clean the table".

Question - is there a way to have the report obtain
arrayed arguments from vba ? if so how ?


The temp table approach is ok as long as you can manage the
bloat issue (recommended approach is to use a temporary
database to hold the temp table).

If the report is fairly simple (no grouping, no aggrgate
functions, ...) then another way that might work is to use
an unbound or "lightly" bound report. This kind of report
can calculate the values (or retrieve them from a recordset,
array or whereever) for each detail control and then use a
Me.NextRecord = False statement to get the report to process
another detail. In this scenario, the general control flow
is along these lines:

Dim index (or Recordset)
Report_Open:
initialize index (or open the recordset)

Detail_Format:
Retrieve a one detail's values from array (or recordset)
and assign the values to text boxes
increment index (or rs.movenext)
Check for end of array (or Recordset)
If more data then Me.NextRecord = False

Report_Close:
Clean up (Close recordset or whatever)
 
Back
Top