473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Fields Report (Access 2000)

Thanks for taking the time to read my question.

I have a table of data that has Date, Data and Category. I need to
show, in
a report, each Categories Data by Date. The Date has to be it's own
column
across the top and Category down the left side.

As data is entered, the number of unique dates increases. As a result
the
number of columns increases. How do you make a report like this in
Access? I
know I can do a crosstab query, but I need to format it etc.

I tried using a basic query that uses just the Category, then adding my
crosstab query to it as a SubDatasheet. Access doesn't like that
either.

Thanks so much for you help on this.

Brad

Ex:
tblData
Date Category Data
1-1-06 Dog Food 6.5
1-1-06 Cat Food 7.2
1-1-06 Bird Seed 1.6
1-1-06 Dog Food 6.4
1-1-06 Cat Food 7.3
1-1-06 Bird Seed 1.5
2-1-06 Dog Food 6.3
2-1-06 Cat Food 7.9
2-1-06 Bird Seed 1.7
2-1-06 Dog Food 6.4
2-1-06 Cat Food 8.0
2-1-06 Bird Seed 1.9
3-1-06 Dog Food 6.9

Report:

Dog Food 1-1-06 2-1-06 3-1-06
6.5 6.3 6.9
6.4 6.4
Cat Food
7.2 7.9
7.3 8.0
Bird Seed
1.6 1.7
1.5 1.9
*** Sent via Developersdex http://www.developersdex.com ***
Feb 8 '06 #1
1 5163
You need to create a crosstab query with a fixed number of columns where the
columns are sized to hold your widest data value. The column labels need to
be named like LblDate1, Lbldate2, LblDate3 so that you can put the label
names in a loop. The column textboxes need to be named similar to the column
labels so you can put the column textboxes in the same loop as the column
labels. You need a query that only includes the Date from your table data
and the query must return unique dates. A DCount on this query or a
resordset.recor dcount on this query sets the total number of columns you
need. Assuming your crosstab report is designed with eight columns, if
(total number of columns needed) Mod 8 = 0, you need to generate (total
number of columns needed)/ 8 pages. If (total number of columns needed) Mod
8 <> 0, you need to generate ((total number of columns needed)/ 8) + 1
pages.

From here you need a loop from 1 to the total number of pages. The crosstab
query needs to be inside the loop and the crosstab query needs a dynamic
criteria so the correct Dates and Data are on the page at each iteration of
the loop. A recordset needs to be built from the Date query and the
recordset needs to be in an internal loop. The internal loop loops from i =
1 to 8. In the internal loop the column label is assigned with Me("LblDate"
& i) = Rst!Date and the column textbox control source is assigned with
Me!("Data" & i) = Rst!Data. The code for the external and internal loops
needs to be in the Open event of the crosstab report. At the end of the
external loop, you need to print the report and then close the report to get
each page of the report. (Page here is not the typical definition of pages
for the report, but is one open, print and close cycle of your code. For
example, if you determine you need 5 pages, you must open, print and close
your report in the external loop five times. In effect you print the same
report over and over just changing the column labels and column data each
time you print.)

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1100 users have come to me from the newsgroups requesting help
re******@pcdata sheet.com


"Brad" <no****@devdex. com> wrote in message
news:0p******** *******@news.us west.net...
Thanks for taking the time to read my question.

I have a table of data that has Date, Data and Category. I need to
show, in
a report, each Categories Data by Date. The Date has to be it's own
column
across the top and Category down the left side.

As data is entered, the number of unique dates increases. As a result
the
number of columns increases. How do you make a report like this in
Access? I
know I can do a crosstab query, but I need to format it etc.

I tried using a basic query that uses just the Category, then adding my
crosstab query to it as a SubDatasheet. Access doesn't like that
either.

Thanks so much for you help on this.

Brad

Ex:
tblData
Date Category Data
1-1-06 Dog Food 6.5
1-1-06 Cat Food 7.2
1-1-06 Bird Seed 1.6
1-1-06 Dog Food 6.4
1-1-06 Cat Food 7.3
1-1-06 Bird Seed 1.5
2-1-06 Dog Food 6.3
2-1-06 Cat Food 7.9
2-1-06 Bird Seed 1.7
2-1-06 Dog Food 6.4
2-1-06 Cat Food 8.0
2-1-06 Bird Seed 1.9
3-1-06 Dog Food 6.9

Report:

Dog Food 1-1-06 2-1-06 3-1-06
6.5 6.3 6.9
6.4 6.4
Cat Food
7.2 7.9
7.3 8.0
Bird Seed
1.6 1.7
1.5 1.9
*** Sent via Developersdex http://www.developersdex.com ***

Feb 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1830
by: puunda | last post by:
Hi, Hope I've posted to the right groups. I'm trying create a Crystal Report for the first time using C# (novice at that as well). The CR I can handel. What I want to do is to have a whole bunch of fields in my application (winforms) which the user can select to include in the report or not. I believe I can use the CR Engine to change the report at runtime. Here
3
3715
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what a spreadsheet might show, the column names will actually be dynamic, based on data from a SQL Server 2000 database. The row data will also come from the same database. So in this case, I will have a main report and a subreport. I've already tried...
5
8303
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report by setting a text box to =Count(*). This works fine. Now I want to count the unique records in my report. I can dynamically create a SELECT statement that counts unique records. My statement looks like this: SELECT DISTINCT...
1
17670
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
0
427
by: CSDunn | last post by:
Hello, I have a format issue on an Access 2000 ADP report that I am going to attempt to explain from a 'ten thousand foot view' : I have an Access 2000 ADP report that has a SQL Server 2000 Stored Procedure as its record source. The Proc is called MM_rptTeacherGroupingTest_sp. In order to help communicate the issue I am having with the report, please take a look at the following: http://www.valverde.edu/home/policy/ReportLayout.htm .
9
14889
by: mooseshoes | last post by:
All: I'm using Access 2000 on a Windows XP platform. My goal is to use a form to gather user criteria which I will then parse into a useable SQL string. At this point I would like to open one or more reports and use the query as the recordsource. What would be a common approach to doing this? I have been using ADO methods up until this point for other tasks.
2
1919
by: Darryl Kerkeslager | last post by:
As the subject above hopefully makes clear, I want to do several reports, "with lots of fields not otherwise in database". These reports also have variable-length text. I have defined the following options (all users have Office 2000): 1. All Access solution. This appears to involve creating forms to enter data that is just put into a report, and never saved - an exercise in wasted development time, to my thinking. Also, the...
7
3391
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the database I am working on. IF(SELECT OBJECT_ID('REPORT')) IS NOT NULL DROP TABLE REPORT_SELECTION
3
18715
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.