Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a report using vb for crosstab (or other solution)

Status
Not open for further replies.

postermmxvicom

Programmer
Jun 25, 2007
114
US
.


TLDR? - see summary at bottom

I have a crosstab query which shows a backlog by month and order.

The query is great! But, I need it to have totals by month and format orders that have shipped red.

So, I thought I'd make a report. Well, you know where this story ends: The number of columns is always changing as are their titles.

So, I looked up some examples.

I saw one where the make a report by year, so there is always twelve columns. It's advantage was that no programming in vb was needed.

But I like my query. I like it having only the current month and months with open orders.

Now I found a microsoft example which generates a report using vb with a variable number of columns. [URL unfurl="true"]http://support.microsoft.com/kb/812719[/url]

This is like what I am thinking. Unfortunately, this example is not enough for me to really understand what is going on. Plus, the report it makes is kinda basic.

So, I am looking for some good resources for understanding how to put together a report using vb. I have a decent background in c++ and have used some vb successfully in my database. Tough programming doesn't daunt me. (however if there is some ridiculously easy way to achieve my goals, I am not a glutton for punishment and will take the easy way)

Things I have questions about specifically:

Can you name a report when you create it using vb? I can create a new one, but haven't figured out how to name it.

I tried to modify the above example to have something in the report header and failed. I thought that would be easy, but...maybe there is something I am missing?

It seems like running the script from microsoft again, would just make more controls on top of the ones already there. How would I start with a new report, if one already existed? (I thought about deleting it, but since I don't know how out make a new one with the same name, that doesn't get me far)

I did a simple search and replace on the microsoft example, providing it with my query and other specifics. However when I run it, it makes a report with one record per page ( and like 66 pages). This was unexpected to me based on their code (which proves to me I _really_ don't understand it)

So to summarize:

The crosstab query is great! But, I need it to have totals by month at the bottom and format orders that have shipped red. So, I should make a report, but the unknown columns make this hard.

I saw one where the make a report by year, so there is always twelve columns. It's advantage was that no programming in vb was needed. This kind of solution is doable and ultimately acceptable, but why not make something nice?

I have a decent background in c++ and have used some vb successfully in my database. Tough programming doesn't daunt me. (however if there is some ridiculously easy way to achieve my goals, I am not a glutton for punishment and will take the easy way)

Aaron

One last thing: Sometimes I wonder; "Is that someone's signature? Or do they type that at the end of each post?
 
Aaron,
It isn't clear which fields are your column headings and which are your row headings. Also, is this really VB or VBA? Are you working totally within Access or are you creating a VB application that opens Access through automation?

IMHO the Microsoft solution is slow, complicated, and lacks flexibility. There is a better solution for Crosstab reports at If your column headings are date intervals, consider the solution in the FAQs of this forum.

Duane
Hook'D on Access
MS Access MVP
 
Duane,

It is VBA, not VB. I think I have looked at your examples, as there are many links to them on the net. But, I will revisit them tomorrow as I understand a little more now.


Remou,

I will look through your links tomorrow at work, thanks for your input.



Aaron

One last thing: Sometimes I wonder; "Is that someone's signature? Or do they type that at the end of each post?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top