473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

problem with crosstabs + reports

Hi
I have created a report based on a Crosstab query
the crosstab query is based on another query
problem i have is that the results this month may be different next
month
having tested this by changing the date i find that the field is not
recongized
how can i design a report that is dynamic i.e.a field may be there
this month but not next month
thanks

kevin
Nov 13 '05 #1
2 1595
On 5 Feb 2005 06:10:16 -0800, ke******@btinternet.com (Kevin) wrote:

The first thing that comes to my mind is that in the Report_Open event
you can inspect the Fields collection of the report's underlying
query, and bind/unbind controls accordingly.
In the below code I am assuming that the control names are the same as
the field names, and that initially they are all unbound (i.e. the
ControlSource is empty). Your report would have enough controls for
the maximum number of fields.
There is an alternative of opening the report in design view
(DoCmd.OpenReport "myreport" acDesign) and using CreateReportControl
to create controls on the fly.

Private Sub Report_Open(Cancel As Integer)
Dim c As Control
Dim f As DAO.Field
Dim rs As DAO.Recordset
' Open same recordset as the report is using, to get to the fields
collection
Set rs = CurrentDb.OpenRecordset(Me.RecordSource, dbOpenSnapshot)
For Each f In rs.Fields
'Check if this field is also a control. If yes, bind it.
For Each c In Me.Controls
If f.Name = c.Name Then
c.ControlSource = f.Name
Exit For
End If
Next c
Next f
rs.Close
Set rs = Nothing
End Sub

-Tom.

Hi
I have created a report based on a Crosstab query
the crosstab query is based on another query
problem i have is that the results this month may be different next
month
having tested this by changing the date i find that the field is not
recongized
how can i design a report that is dynamic i.e.a field may be there
this month but not next month
thanks

kevin


Nov 13 '05 #2
DC
This is not my solution but check out
http://www.experts-exchange.com/Data..._21018004.html
--
Dean Covey
www.coveyaccounting.com

MS-Office Certified:
http://www.microsoft.com/learning/mc...st/default.asp

"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:fi********************************@4ax.com...
On 5 Feb 2005 06:10:16 -0800, ke******@btinternet.com (Kevin) wrote:
I have created a report based on a Crosstab query
the crosstab query is based on another query
problem i have is that the results this month may be different next
month
having tested this by changing the date i find that the field is not
recongized
how can i design a report that is dynamic i.e.a field may be there
this month but not next month


Is the field you're looking for horizontal or vertical?

If it's one of the fields that is horizontal, that is across the top,
then you can use the IN statement of the PIVOT clause to ensure that
the column is always there.

If the field is vertical, that is down the side, then use a separate
query linked back to your crosstab via a LEFT join to ensure the row
is always there.
--
A Bird In The Hand Will Doo Doo On You.

Nov 13 '05 #3

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

Similar topics

1
by: Mithun Verma | last post by:
Hello All, I have a Windows application that uses Crystal Reports 9 (bundled Version) developed using VS.NET 2003 on a windows server 2003 m/c. The application has to be deployed on the client...
1
by: Teresa B | last post by:
I am going through your Brian Bischof's walkthrough in Chapter 1 of his book Crystal Reports .Net Programming and have come up to a problem. When I load the ReportDocument onto the form I get no...
0
by: RCS | last post by:
I have a crystal report which works fine in the Crystal design. The crosstabs display the summarized fields as horizontal, but when I run the same report in dotnet the crosstabs display the...
2
by: John Baker | last post by:
Hi: While the crosstabs capability appears very powerful, I don't see how I can get the information into a form or anything else. Is there some way I can do a cross tabs, and then use the...
2
by: Cassie Pennington | last post by:
I am using VBA to determine which query sits behind a report, depending upon the preferred sort order. This has worked perfectly for ordinary select queries behind reports, but it seems to be...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
8
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
4
by: Andrew | last post by:
I am having an interesting namespace conflict. When we use a third party lib we create a company assembly for any descending classes to go in. I have simplified the problem into the example...
0
lotus18
by: lotus18 | last post by:
Hello World! I have 2 crosstabs on my crystal report. My crosstabs are using only one table. But, I want my second crosstab to retrieve only distinct values. Is this possible? If not, my other...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.