472,811 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Dynamic reports PTII

After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn't
imperative that the dates be down the left, they could be across the top and
the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1-
38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to
that newsgroup.

Cheers,

--
SharkSYA
Nov 12 '05 #1
7 1585
You might want to consider using Excel as your reporting tool.
With an Access report, you won't be able to get very many of your rooms (or
dates) across the top of each page.

HTH
- Turtle
"SharkSYA" <sh****@tw.uk> wrote in message news:40******@clear.net.nz...
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn't imperative that the dates be down the left, they could be across the top and the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1- 38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to that newsgroup.

Cheers,

--
SharkSYA

Nov 12 '05 #2
instead of adding many (many) fields to the report, can you have one
big, long text field and then use the 'format' event to build a string
of X's

is the first query below qroom ?

"SharkSYA" <sh****@tw.uk> wrote in message news:<40******@clear.net.nz>...
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn't
imperative that the dates be down the left, they could be across the top and
the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1-
38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to
that newsgroup.

Cheers,

Nov 12 '05 #3

"Roger" <le*********@natpro.com> wrote in message
news:8c**************************@posting.google.c om...
instead of adding many (many) fields to the report, can you have one
big, long text field and then use the 'format' event to build a string
of X's
How would I do that?

is the first query below qroom ?
Yes, it is.

Thanks for the reply, I think you might be onto something.
--
SharkSYA
"SharkSYA" <sh****@tw.uk> wrote in message news:<40******@clear.net.nz>...
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate box. My problem is that when rooms are added they appear in the query but not in the report based in that query. I hope that this is clearer. It isn't imperative that the dates be down the left, they could be across the top and the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1- 38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to that newsgroup.

Cheers,

Nov 12 '05 #4
If I understand your question properly, I have done what you are talking
about. Basically, what you need is a pool of controls that are hidden by
default and may or may not be used. In the report's Open event handler, you
run a query that gathers up the data on what the column names will be, and
sets the label headers and textbox ControlSource properties accordingly. At
the same time, it makes all the used labels and columns .Visible=True.

Presto - a dynamic report. It's not trivial to code, but it's not horrible
either. The only thing to be careful to remember is that in the Open event
handler is the -only- place where you can set the ControlSource properties
from code at runtime when not in design mode, so that is where you must do it.

- Steve J.

"Trivial stuff is not always easy, but hard stuff isn't always much harder" -
Steve J. (to a client today)

On Sat, 17 Jan 2004 12:37:33 +1300, "SharkSYA" <sh****@tw.uk> wrote:
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn't
imperative that the dates be down the left, they could be across the top and
the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1-
38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to
that newsgroup.

Cheers,


Nov 12 '05 #5
SharkSYA wrote:
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;

And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;

The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn't
imperative that the dates be down the left, they could be across the top and
the rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1-
38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting to
that newsgroup.

Cheers,

--
SharkSYA


Here is what I did. You can check this out...take about 2 minutes. I created a
table with the following fields
RoomID Autonumber, Primary key
Room number
RoomDate Date/Time

I then added a few records for a couple off dates. I entered rooms 1,2,3. for
a few rows and then randomly entered a few dates for each room. Here is my
query.

TRANSFORM Count(Table4.RoomID) AS [The Value]
SELECT Table4.RoomDate, Count(Table4.RoomID) AS [Total Of RoomID]
FROM Table4
GROUP BY Table4.RoomDate
ORDER BY Table4.RoomDate
PIVOT Table4.Room;

When you run it, you get dates down the side, room numbers at the top, and if it
is to be occupied for that date then it has the number 1 in the column, else it
is null.

You can format it to check for the value of 1 or Null and put an X in the
report. No need for a second query.

There is a potential problem with your report if you have PREDEFINED columns at
the top for each room. Lets say you have rooms 1,2, and 3. Room 2 has no
occupancy within the date range. Your columns would be Date, Room1, Room3, no
number 2.

In this case, you might want to create another table, Call it RoomBlank. In
this table, you'd want to create the same structure, and create 76 rows (to
match the number of rooms you have). Enter all of the room numbers BUT leave ALL
of the dates blank.

Now create a query that collects to rooms within the date range and union it to
RoomBlank. You are now assured that all rooms will be listed for your report
whether or not there is an occupancy within the date range. It is with this
query you'd create the crosstab. When you run the report, you'd want to exclude
the row where the date is blank (null)


Nov 12 '05 #6

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:iu********************************@4ax.com...
If I understand your question properly, I have done what you are talking
about. Basically, what you need is a pool of controls that are hidden by
default and may or may not be used. In the report's Open event handler, you run a query that gathers up the data on what the column names will be, and
sets the label headers and textbox ControlSource properties accordingly. At the same time, it makes all the used labels and columns .Visible=True.
Good to hear it is possible!

Presto - a dynamic report. It's not trivial to code, but it's not horrible either. The only thing to be careful to remember is that in the Open event handler is the -only- place where you can set the ControlSource properties
from code at runtime when not in design mode, so that is where you must do it.

Can this be done in SQL as I am unfamiliar with VBA?

Thanks for your help.

Cheers,

--
SharkSYA
- Steve J.

"Trivial stuff is not always easy, but hard stuff isn't always much harder" - Steve J. (to a client today)

On Sat, 17 Jan 2004 12:37:33 +1300, "SharkSYA" <sh****@tw.uk> wrote:
After canvassing ideas it appears that the way I need to do it is not
possible.There are 126 rooms, more to be added, and it needs to print a
report or reports showing 76 days of bookings.

There are two queries involved:

Here's the code(Thanks Bob Q!)

SELECT Calendar.Date, Bookings.room
FROM Calendar, Bookings
WHERE (((Calendar.Date) Between [checkin] And [checkout]))
ORDER BY Calendar.Date, Bookings.room;
And crosstab query:

TRANSFORM IIf(IsNull([room]),"","X") AS Isbooked
SELECT Qroom1.Date
FROM Calendar INNER JOIN Qroom1 ON Calendar.Date=Qroom1.Date
WHERE (((Qroom1.Date)=Date() Or (Qroom1.Date)>Date()))
GROUP BY Qroom1.Date
PIVOT Qroom1.room;
The ideal report has rooms across the top and the dates are down
the left hand side. If a room is booked an 'X' appears in the appropriate
box. My problem is that when rooms are added they appear in the query but
not in the report based in that query. I hope that this is clearer. It isn'timperative that the dates be down the left, they could be across the top andthe rooms down the side.

Any suggestions on how to achieve this would be most welcome. I'm quite
happy to split the reports into seperate rooms or two lots of dates,i.e. 1-38 days & 39 - 76 Days and will entertain any ideas to work around it.

I thought, possibly,it could be achieved by macros hence the new posting tothat newsgroup.

Cheers,

Nov 12 '05 #7

"Salad" <oi*@vinegar.com> wrote in message
news:40***************@vinegar.com...
SharkSYA wrote:
Here is what I did. You can check this out...take about 2 minutes. I created a table with the following fields
RoomID Autonumber, Primary key
Room number
RoomDate Date/Time

I then added a few records for a couple off dates. I entered rooms 1,2,3. for a few rows and then randomly entered a few dates for each room. Here is my query.

TRANSFORM Count(Table4.RoomID) AS [The Value]
SELECT Table4.RoomDate, Count(Table4.RoomID) AS [Total Of RoomID]
FROM Table4
GROUP BY Table4.RoomDate
ORDER BY Table4.RoomDate
PIVOT Table4.Room;

When you run it, you get dates down the side, room numbers at the top, and if it is to be occupied for that date then it has the number 1 in the column, else it is null.

You can format it to check for the value of 1 or Null and put an X in the
report. No need for a second query.

There is a potential problem with your report if you have PREDEFINED columns at the top for each room. Lets say you have rooms 1,2, and 3. Room 2 has no
occupancy within the date range. Your columns would be Date, Room1, Room3, no number 2.

In this case, you might want to create another table, Call it RoomBlank. In this table, you'd want to create the same structure, and create 76 rows (to match the number of rooms you have). Enter all of the room numbers BUT leave ALL of the dates blank.

Now create a query that collects to rooms within the date range and union it to RoomBlank. You are now assured that all rooms will be listed for your report whether or not there is an occupancy within the date range. It is with this query you'd create the crosstab. When you run the report, you'd want to exclude the row where the date is blank (null)


Thanks for that. I'll give it a try.

Cheers,
--
SharkSYA
Nov 12 '05 #8

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

Similar topics

0
by: Tim | last post by:
Hello, Since this is a newsgroup about php & web related topics, I wanted to share a new Search Engine Optimization tool that we just released. I know many of you have non optimized dynamic...
2
by: Sam | last post by:
Hello everyone, I have a table, which contains a picture column, I put URL info into it. "www.myweb.com/1.jpg..." I want to show this picture in my crystal report, I find some samples show the...
1
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...
1
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently...
3
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process....
5
by: Ron | last post by:
I have a bunch of Crystal Reports (v9) published as WebServices and use a ReportViewer to display the reports on the ASPNET page. Everytime we move the reports from dev to production we have to...
0
by: PughDR | last post by:
As the subject of this topic suggestions I am trying to find a way to use ASP, SQL Server, Com+ and Crystal Reports 8.5 to Create Dynamic PDF Reports Over The Web, but the only article I found that...
2
by: fjm | last post by:
Hi all, I have to give users a way to create dynamic reports. Can sombody give me some ideas please? My first thoughts were to create static reports and I'm thinkin' that is not as good as it...
3
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,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.