Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Brainstorming Ideas

37 views
Skip to first unread message

musicloverlch

unread,
May 3, 2022, 2:08:09 PM5/3/22
to
I might not explain this correctly, but I want to see if you have any solutions to my problem.

I would like to create a table that had the following fields

ID(autonumber)
TaskSection (string)
TaskName (String)
CompleteDate (date)

Then the table would have fields like
Task Section TaskName CompleteDate
Census Email Sent 1/1/2022
Census Census Received 1/5/2022
Census Financials Received 1/7/2022

The goal is for the user to be able to add however many tasks they want without me needing to be involved.

My problem is that I would then need to make a view where they could see all the tasks horizontally. The tasks might change so I can't put a fixed list in the crosstab query.

I really want to do this because I'm sick of having to add fields every time they want to track some new date, but I can't figure out how to overcome the crosstab problem.

Thoughts? TIA

Laura


Ron Weiner

unread,
May 3, 2022, 5:45:31 PM5/3/22
to
I dont understand your adversion to Crosstab queries. The Sql syntax
that Access uses is pretty spiffy, and far easier to implement than the
Sql Server version. You should be able to limit the number of columns
by including the only the tasks you are interested in the Where clause.

Here is some "Air Sql" to create the output you want.

TRANSFORM Min(CompleteDate) AS MinCompleteDate
SELECT TaskName
FROM YourTable
WHERE TaskSelection in("Task1", "Task2",....)
GROUP BY TaskName
PIVOT TaskSelection;

Somewhere in front of this sql you could have a form that allows the
user to Select the Task Selection(s) they want to see, and "Bob's your
uncle".

You also will want to control the Values in Task Selection. That would
require another table TaskSelection of with 2 columns TaskSelectionId
and TaskSelection. Then TaskSelectionID becomes a Fk YourTable that you
perform the Crosstab on.

Or perhaps I have totally misunderstood your question.

Rdub


musicloverlch formulated the question :

musicloverlch

unread,
May 4, 2022, 9:36:02 PM5/4/22
to
Thanks for your input. I don't have an aversion to crosstab queries, I just need them to be dynamic. I don't know how many tasks would be listed so it's hard to make a fixed crosstab. I tried making it dynamic, but the column headings were in a crazy order.

Ron Weiner

unread,
May 4, 2022, 9:57:56 PM5/4/22
to
musicloverlch expressed precisely :
You can make Dynamic crosstabs in code by creating the Sql for them on
the fly. Build a form that asks your users to choose the tasks they
are interested in and the Dates to be included. Then make a Sql
statement in code and execute it.

As for the crazy order of the Column headings you can use an IN()
statement at the end of the PIVOT statement to put thinks in whatever
order makes sense for you. Something like:

...
PIVOT TaskSelection IN('ThisTask','ThatTask','AnotherTask');

Rdub
0 new messages