Help creating a report programmatically

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

Guest

I have 16 nonrelated tables that need to be summed and then put into a
report. I have written the code to sum them and it works. I have designed a
report and put in text boxes to hold the data from the tables; each text box
is named. When I try to load the report I get an error 2461.
I have tried to make queries to generate the sums and when I use one query
per table it is ok, but when I try to group queries or tables, I get some
very astronomical numbers.
I had hope that I could generate the sums in code ( completed and works);
Load the report (Error 2461); assign the sums to the text boxes by code; Show
the report.

Is there something preventing this?
 
You are being a bit vague about your table structures etc. Normally if you
have a need to bind controls to fields at run-time, you should provide more
information regarding why this is necessary.
 
If all your tables are unrelated, you won't be able to use a query. Your
attempt to use a query results in a cartesian product number of records
(very astronomical numbers). When you don't join the queries in the query
window, the number of records returned by the query is the number of records
in quey1 x nmber of records in query2 x number of records in query3 ..... x
number of records in query16. ASTRONOMICAL NUMBER!!!

All you can do is put 16 textboxes on your report and use the DSum function
in the control source of each to get the total from each of your 16
nonrelated tables. Then to get the grand total, you need to use the
following in another textbox:
=NameOfTextBox1 + NameOfTextBox2 + NameOfTextBox3 ...... NameOfTextBox16
 
I want to thank you very much for your help. The Dsum worked excellently.

Thanks again
 
Back
Top