pivot table

A

AccessAddict

I can create a pivot table to show data from a query in the view that the
user would like to enter the data into. However, the pivot table will not
let me enter or change the data...the underlying query will let you enter or
change the data (and if I change to datasheet view I can add/change the data.
The user needs to see and change or add data in the pivot table view. Is
there a way to accomplish this?
 
D

Duane Hookom

I am not aware of any method of allowing the editing of records in a pivot
or crosstab query. You can possibly create an unbound form with lots of text
boxes in a grid format that you populate with code. After the user updates
the text boxes, you can run code to update the values back to your tables.
 
A

AccessAddict

Duane...
Thank you for your response to my dilema...it might work (I haven't given it
the focus that it deserves yet) but I also need to bring in the data that is
already there.

I apologize for my delay in responding to your response, I was in-depth in
formulating my own solution, as I read yours I wasn't sure if mine would work
or not...but I was not ready to investigate yours yet...since the user needs
to see the data in the field as it is currently in the table (before changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new table
(since you cannot turn a crosstab query into a make table). I, then, run an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table, but in
the cells that are blank in the "crosstab" new table, I cannot add an amount.
This is a problem, as these amounts move around from month to month and
amount to amount. As it stands, only amounts that show can be changed. Is
there something that I am missing here? I do know that now the date fields
are no longer dates but field names which means that a date is not getting
into the original table as a "start date" because now it is the name of the
field. Do you have an idea on this? I removed the key (which combined [item
#] with [start date] as the key), thinking that, of course, it wouldn't
work...but now thinking...it is not putting a date in the original table.
For the crosstab query, I have already concatenated three fields together to
get the group and the user needs to see the item # and a description of the
product...crosstabs only let you enter three row fields...and one column
field and one value field. I also need "start date" to be updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I will
try to simplify. Thanks again.
 
D

Duane Hookom

You can use a crosstab as the source for a maketable query. I don't know the
SQL of your crosstab or the structure of your original table so I can't be
of much additional help.

--
Duane Hookom
MS Access MVP
--

AccessAddict said:
Duane...
Thank you for your response to my dilema...it might work (I haven't given
it
the focus that it deserves yet) but I also need to bring in the data that
is
already there.

I apologize for my delay in responding to your response, I was in-depth in
formulating my own solution, as I read yours I wasn't sure if mine would
work
or not...but I was not ready to investigate yours yet...since the user
needs
to see the data in the field as it is currently in the table (before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new
table
(since you cannot turn a crosstab query into a make table). I, then, run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table, but in
the cells that are blank in the "crosstab" new table, I cannot add an
amount.
This is a problem, as these amounts move around from month to month and
amount to amount. As it stands, only amounts that show can be changed.
Is
there something that I am missing here? I do know that now the date
fields
are no longer dates but field names which means that a date is not getting
into the original table as a "start date" because now it is the name of
the
field. Do you have an idea on this? I removed the key (which combined
[item
#] with [start date] as the key), thinking that, of course, it wouldn't
work...but now thinking...it is not putting a date in the original table.
For the crosstab query, I have already concatenated three fields together
to
get the group and the user needs to see the item # and a description of
the
product...crosstabs only let you enter three row fields...and one column
field and one value field. I also need "start date" to be updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I
will
try to simplify. Thanks again.

Duane Hookom said:
I am not aware of any method of allowing the editing of records in a
pivot
or crosstab query. You can possibly create an unbound form with lots of
text
boxes in a grid format that you populate with code. After the user
updates
the text boxes, you can run code to update the values back to your
tables.
 
A

AccessAddict

I apologize for the name of the query (as it started out as a Pivot Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table] to the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table]. There
are several Post Off’s for each item #.

The crosstab query gives me the structure that I need for user input, but
does not let me type into the cells…
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS [FirstOfPost Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable Update].[Post Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for updating
groups of similar data – with similar structures)

But….

When turned into a make table…gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as follows:

* Date field names continue (as below) across the table…

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005 |
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005 |
1/7/2005 | 1/9/2005 | 10/2/2005…….

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
..
..
..
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
..
..
..
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
..
..
..
The [Total Of Post Off] field is not used but the crosstab puts it there

*the table continues horizontally across in the following order: 10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005 2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005 5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005 6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005 8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier] [Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) – contains the item #, PO Start date, PO End
date, PO Amt, Notes, initial date
The New Table – is structured as above with the actual dates used as the
field names now
The update queries update each of these individual date fields to the post
off table by matching the date to the PO date
Since it is matching the date…if I type something in the blank date field in
the new table it does not update to the PO Table,
Whereas, if I type over an amount…it does.

Can anyone tell me how to get the blank fields (filled-in) to update to the
Post Off Table as well?


AccessAddict said:
Duane...
Thank you for your response to my dilema...it might work (I haven't given it
the focus that it deserves yet) but I also need to bring in the data that is
already there.

I apologize for my delay in responding to your response, I was in-depth in
formulating my own solution, as I read yours I wasn't sure if mine would work
or not...but I was not ready to investigate yours yet...since the user needs
to see the data in the field as it is currently in the table (before changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new table
(since you cannot turn a crosstab query into a make table). I, then, run an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table, but in
the cells that are blank in the "crosstab" new table, I cannot add an amount.
This is a problem, as these amounts move around from month to month and
amount to amount. As it stands, only amounts that show can be changed. Is
there something that I am missing here? I do know that now the date fields
are no longer dates but field names which means that a date is not getting
into the original table as a "start date" because now it is the name of the
field. Do you have an idea on this? I removed the key (which combined [item
#] with [start date] as the key), thinking that, of course, it wouldn't
work...but now thinking...it is not putting a date in the original table.
For the crosstab query, I have already concatenated three fields together to
get the group and the user needs to see the item # and a description of the
product...crosstabs only let you enter three row fields...and one column
field and one value field. I also need "start date" to be updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I will
try to simplify. Thanks again.

Duane Hookom said:
I am not aware of any method of allowing the editing of records in a pivot
or crosstab query. You can possibly create an unbound form with lots of text
boxes in a grid format that you populate with code. After the user updates
the text boxes, you can run code to update the values back to your tables.
 
D

Duane Hookom

Do you have any limits on the number of columns created in your crosstab?
I guess I would create an unbound form that code fills from a recordset.
When the user is done updating the unbound grid of text boxes, more code
would loop through the controls and either update or append values to your
original table.

--
Duane Hookom
MS Access MVP


AccessAddict said:
I apologize for the name of the query (as it started out as a Pivot Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table] to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user input, but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS [FirstOfPost Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005 |
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005 |
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
.
.
.
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
.
.
.
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
.
.
.
The [Total Of Post Off] field is not used but the crosstab puts it there

*the table continues horizontally across in the following order:
10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005 2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005
5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005
6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005
8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and
re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier]
[Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) - contains the item #, PO Start date, PO
End
date, PO Amt, Notes, initial date
The New Table - is structured as above with the actual dates used as the
field names now
The update queries update each of these individual date fields to the post
off table by matching the date to the PO date
Since it is matching the date.if I type something in the blank date field
in
the new table it does not update to the PO Table,
Whereas, if I type over an amount.it does.

Can anyone tell me how to get the blank fields (filled-in) to update to
the
Post Off Table as well?


AccessAddict said:
Duane...
Thank you for your response to my dilema...it might work (I haven't given
it
the focus that it deserves yet) but I also need to bring in the data that
is
already there.

I apologize for my delay in responding to your response, I was in-depth
in
formulating my own solution, as I read yours I wasn't sure if mine would
work
or not...but I was not ready to investigate yours yet...since the user
needs
to see the data in the field as it is currently in the table (before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new
table
(since you cannot turn a crosstab query into a make table). I, then, run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table, but
in
the cells that are blank in the "crosstab" new table, I cannot add an
amount.
This is a problem, as these amounts move around from month to month and
amount to amount. As it stands, only amounts that show can be changed.
Is
there something that I am missing here? I do know that now the date
fields
are no longer dates but field names which means that a date is not
getting
into the original table as a "start date" because now it is the name of
the
field. Do you have an idea on this? I removed the key (which combined
[item
#] with [start date] as the key), thinking that, of course, it wouldn't
work...but now thinking...it is not putting a date in the original table.
For the crosstab query, I have already concatenated three fields together
to
get the group and the user needs to see the item # and a description of
the
product...crosstabs only let you enter three row fields...and one column
field and one value field. I also need "start date" to be updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I
will
try to simplify. Thanks again.

Duane Hookom said:
I am not aware of any method of allowing the editing of records in a
pivot
or crosstab query. You can possibly create an unbound form with lots of
text
boxes in a grid format that you populate with code. After the user
updates
the text boxes, you can run code to update the values back to your
tables.

--
Duane Hookom
MS Access MVP


message
I can create a pivot table to show data from a query in the view that
the
user would like to enter the data into. However, the pivot table
will not
let me enter or change the data...the underlying query will let you
enter
or
change the data (and if I change to datasheet view I can add/change
the
data.
The user needs to see and change or add data in the pivot table view.
Is
there a way to accomplish this?
 
A

AccessAddict

Duane...
As far as I know, I have no limit on the number of columns created in the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates would be
three additional per month...give or take a few. Some months will have more
than three others none. The way their calendar works 7/1/2005 is really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is the
only date for December. These dates are dynamic in that all dates after the
current date are subject to the addition of another date before the year ends.
I am not familiar with "unbound" forms... I have always used forms bound to
queries or tables. I just tried to create an unbound form with text boxes as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back with
#Name?... Should I be entering the code into the SQL view? Or am I using
the wrong syntax? Could you give me an example of what you are talking about?

I appreciate your help and just because I'm addicted doesn't mean that I
know everything...LOL I'm addicted to the learning of it...I'm a "can't stop
until I find a solution" type of addict..."where there's a will there's a way"

Thanks for your time Duane...

Duane Hookom said:
Do you have any limits on the number of columns created in your crosstab?
I guess I would create an unbound form that code fills from a recordset.
When the user is done updating the unbound grid of text boxes, more code
would loop through the controls and either update or append values to your
original table.

--
Duane Hookom
MS Access MVP


AccessAddict said:
I apologize for the name of the query (as it started out as a Pivot Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table] to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user input, but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS [FirstOfPost Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005 |
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005 |
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
.
.
.
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
.
.
.
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
.
.
.
The [Total Of Post Off] field is not used but the crosstab puts it there

*the table continues horizontally across in the following order:
10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005 2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005
5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005
6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005
8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and
re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier]
[Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) - contains the item #, PO Start date, PO
End
date, PO Amt, Notes, initial date
The New Table - is structured as above with the actual dates used as the
field names now
The update queries update each of these individual date fields to the post
off table by matching the date to the PO date
Since it is matching the date.if I type something in the blank date field
in
the new table it does not update to the PO Table,
Whereas, if I type over an amount.it does.

Can anyone tell me how to get the blank fields (filled-in) to update to
the
Post Off Table as well?


AccessAddict said:
Duane...
Thank you for your response to my dilema...it might work (I haven't given
it
the focus that it deserves yet) but I also need to bring in the data that
is
already there.

I apologize for my delay in responding to your response, I was in-depth
in
formulating my own solution, as I read yours I wasn't sure if mine would
work
or not...but I was not ready to investigate yours yet...since the user
needs
to see the data in the field as it is currently in the table (before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new
table
(since you cannot turn a crosstab query into a make table). I, then, run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table, but
in
the cells that are blank in the "crosstab" new table, I cannot add an
amount.
This is a problem, as these amounts move around from month to month and
amount to amount. As it stands, only amounts that show can be changed.
Is
there something that I am missing here? I do know that now the date
fields
are no longer dates but field names which means that a date is not
getting
into the original table as a "start date" because now it is the name of
the
field. Do you have an idea on this? I removed the key (which combined
[item
#] with [start date] as the key), thinking that, of course, it wouldn't
work...but now thinking...it is not putting a date in the original table.
For the crosstab query, I have already concatenated three fields together
to
get the group and the user needs to see the item # and a description of
the
product...crosstabs only let you enter three row fields...and one column
field and one value field. I also need "start date" to be updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I
will
try to simplify. Thanks again.

:

I am not aware of any method of allowing the editing of records in a
pivot
or crosstab query. You can possibly create an unbound form with lots of
text
boxes in a grid format that you populate with code. After the user
updates
the text boxes, you can run code to update the values back to your
tables.

--
Duane Hookom
MS Access MVP


message
I can create a pivot table to show data from a query in the view that
the
user would like to enter the data into. However, the pivot table
will not
let me enter or change the data...the underlying query will let you
enter
or
change the data (and if I change to datasheet view I can add/change
the
data.
The user needs to see and change or add data in the pivot table view.
Is
there a way to accomplish this?
 
D

Duane Hookom

This might be a bit complex but your question is complex. I created a form
in the Northwind database with 18 text boxes in a grid of 6 columns and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and places
customers and order dates into the text boxes. Code would need to be written
that would loop through the controls on the form and either update or append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or intOrder > 4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
As far as I know, I have no limit on the number of columns created in the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates would
be
three additional per month...give or take a few. Some months will have
more
than three others none. The way their calendar works 7/1/2005 is really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is
the
only date for December. These dates are dynamic in that all dates after
the
current date are subject to the addition of another date before the year
ends.
I am not familiar with "unbound" forms... I have always used forms bound
to
queries or tables. I just tried to create an unbound form with text boxes
as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back with
#Name?... Should I be entering the code into the SQL view? Or am I using
the wrong syntax? Could you give me an example of what you are talking
about?

I appreciate your help and just because I'm addicted doesn't mean that I
know everything...LOL I'm addicted to the learning of it...I'm a "can't
stop
until I find a solution" type of addict..."where there's a will there's a
way"

Thanks for your time Duane...

Duane Hookom said:
Do you have any limits on the number of columns created in your crosstab?
I guess I would create an unbound form that code fills from a recordset.
When the user is done updating the unbound grid of text boxes, more code
would loop through the controls and either update or append values to
your
original table.

--
Duane Hookom
MS Access MVP


AccessAddict said:
I apologize for the name of the query (as it started out as a Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table] to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS [FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for
updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005 |
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005 |
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
.
.
.
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
.
.
.
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
.
.
.
The [Total Of Post Off] field is not used but the crosstab puts it
there

*the table continues horizontally across in the following order:
10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005 2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005
5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005
6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005
8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and
re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier]
[Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) - contains the item #, PO Start date,
PO
End
date, PO Amt, Notes, initial date
The New Table - is structured as above with the actual dates used as
the
field names now
The update queries update each of these individual date fields to the
post
off table by matching the date to the PO date
Since it is matching the date.if I type something in the blank date
field
in
the new table it does not update to the PO Table,
Whereas, if I type over an amount.it does.

Can anyone tell me how to get the blank fields (filled-in) to update to
the
Post Off Table as well?


:

Duane...
Thank you for your response to my dilema...it might work (I haven't
given
it
the focus that it deserves yet) but I also need to bring in the data
that
is
already there.

I apologize for my delay in responding to your response, I was
in-depth
in
formulating my own solution, as I read yours I wasn't sure if mine
would
work
or not...but I was not ready to investigate yours yet...since the user
needs
to see the data in the field as it is currently in the table (before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new
table
(since you cannot turn a crosstab query into a make table). I, then,
run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table,
but
in
the cells that are blank in the "crosstab" new table, I cannot add an
amount.
This is a problem, as these amounts move around from month to month
and
amount to amount. As it stands, only amounts that show can be
changed.
Is
there something that I am missing here? I do know that now the date
fields
are no longer dates but field names which means that a date is not
getting
into the original table as a "start date" because now it is the name
of
the
field. Do you have an idea on this? I removed the key (which
combined
[item
#] with [start date] as the key), thinking that, of course, it
wouldn't
work...but now thinking...it is not putting a date in the original
table.
For the crosstab query, I have already concatenated three fields
together
to
get the group and the user needs to see the item # and a description
of
the
product...crosstabs only let you enter three row fields...and one
column
field and one value field. I also need "start date" to be
updatable...I
guess as a value.

I don't know if I have confused you more or what...let me know...and I
will
try to simplify. Thanks again.

:

I am not aware of any method of allowing the editing of records in a
pivot
or crosstab query. You can possibly create an unbound form with lots
of
text
boxes in a grid format that you populate with code. After the user
updates
the text boxes, you can run code to update the values back to your
tables.

--
Duane Hookom
MS Access MVP


message
I can create a pivot table to show data from a query in the view
that
the
user would like to enter the data into. However, the pivot table
will not
let me enter or change the data...the underlying query will let
you
enter
or
change the data (and if I change to datasheet view I can
add/change
the
data.
The user needs to see and change or add data in the pivot table
view.
Is
there a way to accomplish this?
 
A

AccessAddict

Duane...
I created a form with 20 rows and 36 columns - formatted as you suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show #Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) = .Fields("Post Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


Duane Hookom said:
This might be a bit complex but your question is complex. I created a form
in the Northwind database with 18 text boxes in a grid of 6 columns and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and places
customers and order dates into the text boxes. Code would need to be written
that would loop through the controls on the form and either update or append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or intOrder > 4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
As far as I know, I have no limit on the number of columns created in the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates would
be
three additional per month...give or take a few. Some months will have
more
than three others none. The way their calendar works 7/1/2005 is really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is
the
only date for December. These dates are dynamic in that all dates after
the
current date are subject to the addition of another date before the year
ends.
I am not familiar with "unbound" forms... I have always used forms bound
to
queries or tables. I just tried to create an unbound form with text boxes
as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back with
#Name?... Should I be entering the code into the SQL view? Or am I using
the wrong syntax? Could you give me an example of what you are talking
about?

I appreciate your help and just because I'm addicted doesn't mean that I
know everything...LOL I'm addicted to the learning of it...I'm a "can't
stop
until I find a solution" type of addict..."where there's a will there's a
way"

Thanks for your time Duane...

Duane Hookom said:
Do you have any limits on the number of columns created in your crosstab?
I guess I would create an unbound form that code fills from a recordset.
When the user is done updating the unbound grid of text boxes, more code
would loop through the controls and either update or append values to
your
original table.

--
Duane Hookom
MS Access MVP


I apologize for the name of the query (as it started out as a Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table] to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS [FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for
updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005 |
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005 |
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
.
.
.
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
.
.
.
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
.
.
.
The [Total Of Post Off] field is not used but the crosstab puts it
there

*the table continues horizontally across in the following order:
10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005 2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005
5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005
6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005
8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and
re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier]
[Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) - contains the item #, PO Start date,
PO
End
date, PO Amt, Notes, initial date
The New Table - is structured as above with the actual dates used as
the
field names now
The update queries update each of these individual date fields to the
post
off table by matching the date to the PO date
Since it is matching the date.if I type something in the blank date
field
in
the new table it does not update to the PO Table,
Whereas, if I type over an amount.it does.

Can anyone tell me how to get the blank fields (filled-in) to update to
the
Post Off Table as well?


:

Duane...
Thank you for your response to my dilema...it might work (I haven't
given
it
the focus that it deserves yet) but I also need to bring in the data
that
is
already there.

I apologize for my delay in responding to your response, I was
in-depth
in
formulating my own solution, as I read yours I wasn't sure if mine
would
work
or not...but I was not ready to investigate yours yet...since the user
needs
to see the data in the field as it is currently in the table (before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a new
table
(since you cannot turn a crosstab query into a make table). I, then,
run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table,
but
in
the cells that are blank in the "crosstab" new table, I cannot add an
amount.
This is a problem, as these amounts move around from month to month
and
amount to amount. As it stands, only amounts that show can be
changed.
Is
there something that I am missing here? I do know that now the date
 
D

Duane Hookom

You are being punished for allowing spaces and punctuation in your object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
I created a form with 20 rows and 36 columns - formatted as you suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show #Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) = .Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


Duane Hookom said:
This might be a bit complex but your question is complex. I created a
form
in the Northwind database with 18 text boxes in a grid of 6 columns and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
As far as I know, I have no limit on the number of columns created in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates
would
be
three additional per month...give or take a few. Some months will have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before the
year
ends.
I am not familiar with "unbound" forms... I have always used forms
bound
to
queries or tables. I just tried to create an unbound form with text
boxes
as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back
with
#Name?... Should I be entering the code into the SQL view? Or am I
using
the wrong syntax? Could you give me an example of what you are talking
about?

I appreciate your help and just because I'm addicted doesn't mean that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
until I find a solution" type of addict..."where there's a will there's
a
way"

Thanks for your time Duane...

:

Do you have any limits on the number of columns created in your
crosstab?
I guess I would create an unbound form that code fills from a
recordset.
When the user is done updating the unbound grid of text boxes, more
code
would loop through the controls and either update or append values to
your
original table.

--
Duane Hookom
MS Access MVP


message
I apologize for the name of the query (as it started out as a Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table]
to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user
input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS
[FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable
Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for
updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of
Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005
|
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005
|
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6
.
.
.
Listed under Item #
Test 100
Test 101
172173
172181
172199
172207
.
.
.
Listed under Item Description
3 Graces
3 Graces
Cabernet California
Chardonnay, Austrailian
Souvignon Blanc/Semillon, New Zealand
Shiraz Austrailian
Malbec
Syrah
.
.
.
The [Total Of Post Off] field is not used but the crosstab puts it
there

*the table continues horizontally across in the following order:
10/27/2005
10/30/2005 10/31/2005 11/27/2005 2/10/2005 2/13/2005 2/27/2005
2/6/2005
3/1/2005 3/13/2005 3/17/2005
3/20/2005 3/27/2005 4/1/2005 4/10/2005 4/13/2005 4/15/2005 4/17/2005
4/19/2005 4/26/2005 4/3/2005 5/1/2005 5/12/2005 5/15/2005 5/2/2005
5/22/2005
5/24/2005 5/28/2005
5/8/2005 6/1/2005 6/12/2005 6/14/2005 6/19/2005 6/26/2005 6/3/2005
6/4/2005
6/5/2005 7/1/2005 7/17/2005 7/24/2005 7/3/2005 7/31/2005 8/1/2005
8/14/2005
8/21/2005 8/22/2005
8/31/2005 9/1/2005 9/3/2005 9/4/2005
(This order is corrected in the new table (which is cleared and
re-populated
each time)

Listed under SUPSUBFL (these are the concatenated fields [Supplier]
[Brand]
[Frontline Price]

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Azure Bay/90
Allied Domecq/Balbi/75.6
Allied Domecq/Balbi/75.6

Items table - contains all data relating to all items
Post Off Table (original table) - contains the item #, PO Start
date,
PO
End
date, PO Amt, Notes, initial date
The New Table - is structured as above with the actual dates used as
the
field names now
The update queries update each of these individual date fields to
the
post
off table by matching the date to the PO date
Since it is matching the date.if I type something in the blank date
field
in
the new table it does not update to the PO Table,
Whereas, if I type over an amount.it does.

Can anyone tell me how to get the blank fields (filled-in) to update
to
the
Post Off Table as well?


:

Duane...
Thank you for your response to my dilema...it might work (I haven't
given
it
the focus that it deserves yet) but I also need to bring in the
data
that
is
already there.

I apologize for my delay in responding to your response, I was
in-depth
in
formulating my own solution, as I read yours I wasn't sure if mine
would
work
or not...but I was not ready to investigate yours yet...since the
user
needs
to see the data in the field as it is currently in the table
(before
changing
or adding data), that said:

Here is what I did...

I sent the crosstab query out to Excel and brought it back in as a
new
table
(since you cannot turn a crosstab query into a make table). I,
then,
run
an
update macro updating my original table from this new table.

This seems to work (partially)...the user sees the data in groups
of
records
(horizontally) and (if there is data) can change the amounts in the
"crosstab" new table which is then updated to the original
table...however,
the word "change" tells it all...
I can change an amount fine...and it updates to the original table,
but
in
the cells that are blank in the "crosstab" new table, I cannot add
an
amount.
This is a problem, as these amounts move around from month to
month
and
amount to amount. As it stands, only amounts that show can be
changed.
Is
there something that I am missing here? I do know that now the
date
 
A

AccessAddict

I should know better than that...but since Access lets you...I guess I
decided, at some point, to wait until something like this happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the queries,
forms, reports, etc.? I am used to using Access 97...I have noticed that in
Access 2003...I did change a name and it surprised me and changed someplace
automatically...but does it change in all places? ...or should I expect more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form) disappear when
I get the code (which fills them) correct? ... or is that an entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much of this
thread has had much to do with Pivot Tables...LOL...although the final layout
will be like a Pivot Table...but editable and updatable. Since this is a
forum to help others, should I try to change the name of this question...or
is that not do-able?

Thanks...Donna



Duane Hookom said:
You are being punished for allowing spaces and punctuation in your object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
I created a form with 20 rows and 36 columns - formatted as you suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show #Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) = .Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


Duane Hookom said:
This might be a bit complex but your question is complex. I created a
form
in the Northwind database with 18 text boxes in a grid of 6 columns and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


Duane...
As far as I know, I have no limit on the number of columns created in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates
would
be
three additional per month...give or take a few. Some months will have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before the
year
ends.
I am not familiar with "unbound" forms... I have always used forms
bound
to
queries or tables. I just tried to create an unbound form with text
boxes
as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back
with
#Name?... Should I be entering the code into the SQL view? Or am I
using
the wrong syntax? Could you give me an example of what you are talking
about?

I appreciate your help and just because I'm addicted doesn't mean that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
until I find a solution" type of addict..."where there's a will there's
a
way"

Thanks for your time Duane...

:

Do you have any limits on the number of columns created in your
crosstab?
I guess I would create an unbound form that code fills from a
recordset.
When the user is done updating the unbound grid of text boxes, more
code
would loop through the controls and either update or append values to
your
original table.

--
Duane Hookom
MS Access MVP


message
I apologize for the name of the query (as it started out as a Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table]
to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user
input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS
[FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable
Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for
updating
groups of similar data - with similar structures)

But..

When turned into a make table.gives me these fields

Item # Item Description Expr1003 FirstOfPost Off Price Total Of
Post
Off Price
172173 Same description for all 1/2/2005 72 72
172173 Same description for all 1/30/2005 72 72
172173 Same description for all 10/2/2005 40.08 40.08
172173 Same description for all 10/30/2005 40.08 40.08
. . .
. . .
. . .
When I send it out to Excel it keeps the structure that I need, as
follows:

* Date field names continue (as below) across the table.

SUPSUBFL | Item # | Item Description | Total Of Post Off | 1/13/2005
|
1/13/2005 | 1/16/2005 | 1/2/2005 | 1/23/2005 | 1/25/2005 | 1/30/2005
|
1/7/2005 | 1/9/2005 | 10/2/2005...

Listed under SUPSUBFL

AIG Wine & Spirits/Napa-Saki/100
AIG Wine & Spirits/Napa-Saki/100
Allied Domecq/Azure Bay/90
 
A

AccessAddict

I just tried to change a table name...of course, it doesn't change in all the
places that I have used it. Since I see that this is a big job, I will wait
for your response to see if there is an easier way... :-( .

AccessAddict said:
I should know better than that...but since Access lets you...I guess I
decided, at some point, to wait until something like this happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the queries,
forms, reports, etc.? I am used to using Access 97...I have noticed that in
Access 2003...I did change a name and it surprised me and changed someplace
automatically...but does it change in all places? ...or should I expect more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form) disappear when
I get the code (which fills them) correct? ... or is that an entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much of this
thread has had much to do with Pivot Tables...LOL...although the final layout
will be like a Pivot Table...but editable and updatable. Since this is a
forum to help others, should I try to change the name of this question...or
is that not do-able?

Thanks...Donna



Duane Hookom said:
You are being punished for allowing spaces and punctuation in your object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
I created a form with 20 rows and 36 columns - formatted as you suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show #Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) = .Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I created a
form
in the Northwind database with 18 text boxes in a grid of 6 columns and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


Duane...
As far as I know, I have no limit on the number of columns created in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd dates
would
be
three additional per month...give or take a few. Some months will have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands now
10/30/2005 & 10/31/2005 are the only two for November and 11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before the
year
ends.
I am not familiar with "unbound" forms... I have always used forms
bound
to
queries or tables. I just tried to create an unbound form with text
boxes
as
you said...(of course, my text boxes are referencing tables EX: =[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come back
with
#Name?... Should I be entering the code into the SQL view? Or am I
using
the wrong syntax? Could you give me an example of what you are talking
about?

I appreciate your help and just because I'm addicted doesn't mean that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
until I find a solution" type of addict..."where there's a will there's
a
way"

Thanks for your time Duane...

:

Do you have any limits on the number of columns created in your
crosstab?
I guess I would create an unbound form that code fills from a
recordset.
When the user is done updating the unbound grid of text boxes, more
code
would loop through the controls and either update or append values to
your
original table.

--
Duane Hookom
MS Access MVP


message
I apologize for the name of the query (as it started out as a Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off Table]
to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user
input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS
[FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description], First([PivotTable
Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes (for
updating
groups of similar data - with similar structures)

But..
 
D

Duane Hookom

If you use spaces and punctuation, you must wrap your object names in [ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I just tried to change a table name...of course, it doesn't change in all
the
places that I have used it. Since I see that this is a big job, I will
wait
for your response to see if there is an easier way... :-( .

AccessAddict said:
I should know better than that...but since Access lets you...I guess I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form) disappear
when
I get the code (which fills them) correct? ... or is that an entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much of
this
thread has had much to do with Pivot Tables...LOL...although the final
layout
will be like a Pivot Table...but editable and updatable. Since this is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



Duane Hookom said:
You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I created
a
form
in the Northwind database with 18 text boxes in a grid of 6 columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or
intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


message
Duane...
As far as I know, I have no limit on the number of columns created
in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd
dates
would
be
three additional per month...give or take a few. Some months will
have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands
now
10/30/2005 & 10/31/2005 are the only two for November and
11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before
the
year
ends.
I am not familiar with "unbound" forms... I have always used
forms
bound
to
queries or tables. I just tried to create an unbound form with
text
boxes
as
you said...(of course, my text boxes are referencing tables EX:
=[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come
back
with
#Name?... Should I be entering the code into the SQL view? Or am
I
using
the wrong syntax? Could you give me an example of what you are
talking
about?

I appreciate your help and just because I'm addicted doesn't mean
that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
until I find a solution" type of addict..."where there's a will
there's
a
way"

Thanks for your time Duane...

:

Do you have any limits on the number of columns created in your
crosstab?
I guess I would create an unbound form that code fills from a
recordset.
When the user is done updating the unbound grid of text boxes,
more
code
would loop through the controls and either update or append
values to
your
original table.

--
Duane Hookom
MS Access MVP


message
I apologize for the name of the query (as it started out as a
Pivot
Table
then I tried the crosstab)

[PivotTable Update] is a select query combining the [Post-Off
Table]
to
the
[Items Table] using the item # as key (Items table)
and [item #] combined with the [start date] as key [Post Off
Table].
There
are several Post Off's for each item #.

The crosstab query gives me the structure that I need for user
input,
but
does not let me type into the cells.
-------------
This is the SQL:
TRANSFORM First([PivotTable Update].[Post Off Price]) AS
[FirstOfPost
Off
Price]
SELECT [PivotTable Update].SUPSUBFL, [PivotTable Update].[Item
#],
[PivotTable Update].[Item Description], First([PivotTable
Update].[Post
Off
Price]) AS [Total Of Post Off Price]
FROM [PivotTable Update]
GROUP BY [PivotTable Update].SUPSUBFL, [PivotTable
Update].[Item #],
[PivotTable Update].[Item Description]
PIVOT Format([Post Off Start Date],"Short Date");
---------------------
SUPSUBFL = combination of three fields for grouping purposes
(for
updating
groups of similar data - with similar structures)

But..
 
A

AccessAddict

Thanks Duane...my first instinct was to add the brackets, but since I am not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used to...

Duane Hookom said:
If you use spaces and punctuation, you must wrap your object names in [ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I just tried to change a table name...of course, it doesn't change in all
the
places that I have used it. Since I see that this is a big job, I will
wait
for your response to see if there is an easier way... :-( .

AccessAddict said:
I should know better than that...but since Access lets you...I guess I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form) disappear
when
I get the code (which fills them) correct? ... or is that an entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much of
this
thread has had much to do with Pivot Tables...LOL...although the final
layout
will be like a Pivot Table...but editable and updatable. Since this is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I created
a
form
in the Northwind database with 18 text boxes in a grid of 6 columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or
intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


message
Duane...
As far as I know, I have no limit on the number of columns created
in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd
dates
would
be
three additional per month...give or take a few. Some months will
have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands
now
10/30/2005 & 10/31/2005 are the only two for November and
11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before
the
year
ends.
I am not familiar with "unbound" forms... I have always used
forms
bound
to
queries or tables. I just tried to create an unbound form with
text
boxes
as
you said...(of course, my text boxes are referencing tables EX:
=[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come
back
with
#Name?... Should I be entering the code into the SQL view? Or am
I
using
the wrong syntax? Could you give me an example of what you are
talking
about?

I appreciate your help and just because I'm addicted doesn't mean
that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
until I find a solution" type of addict..."where there's a will
there's
a
way"

Thanks for your time Duane...
 
A

AccessAddict

I apologize for the fact that these are syntax errors...I will get it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over the word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


AccessAddict said:
Thanks Duane...my first instinct was to add the brackets, but since I am not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used to...

Duane Hookom said:
If you use spaces and punctuation, you must wrap your object names in [ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I just tried to change a table name...of course, it doesn't change in all
the
places that I have used it. Since I see that this is a big job, I will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I guess I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form) disappear
when
I get the code (which fills them) correct? ... or is that an entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much of
this
thread has had much to do with Pivot Tables...LOL...although the final
layout
will be like a Pivot Table...but editable and updatable. Since this is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to
inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off Price'
'Plus, the text boxes that I created on the form with the names show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO > 11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I created
a
form
in the Northwind database with 18 text boxes in a grid of 6 columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need to be
written
that would loop through the controls on the form and either update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or
intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


message
Duane...
As far as I know, I have no limit on the number of columns created
in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd
dates
would
be
three additional per month...give or take a few. Some months will
have
more
than three others none. The way their calendar works 7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it stands
now
10/30/2005 & 10/31/2005 are the only two for November and
11/26/2005 is
the
only date for December. These dates are dynamic in that all dates
after
the
current date are subject to the addition of another date before
the
year
ends.
I am not familiar with "unbound" forms... I have always used
forms
bound
to
queries or tables. I just tried to create an unbound form with
text
boxes
as
you said...(of course, my text boxes are referencing tables EX:
=[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions come
back
with
#Name?... Should I be entering the code into the SQL view? Or am
I
using
the wrong syntax? Could you give me an example of what you are
talking
about?

I appreciate your help and just because I'm addicted doesn't mean
that
I
know everything...LOL I'm addicted to the learning of it...I'm a
"can't
stop
 
D

Duane Hookom

My code from earlier reply:
strCustomer = .Fields("CompanyName")
Your code:
strItem=.fields(SUPSUBFL)

Note the difference?

--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I apologize for the fact that these are syntax errors...I will get it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over the
word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


AccessAddict said:
Thanks Duane...my first instinct was to add the brackets, but since I am
not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used to...

Duane Hookom said:
If you use spaces and punctuation, you must wrap your object names in
[ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

message
I just tried to change a table name...of course, it doesn't change in
all
the
places that I have used it. Since I see that this is a big job, I
will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I guess
I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed
that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I
expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form)
disappear
when
I get the code (which fills them) correct? ... or is that an
entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much
of
this
thread has had much to do with Pivot Tables...LOL...although the
final
layout
will be like a Pivot Table...but editable and updatable. Since this
is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back
for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to

inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING
TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST
OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off
Price'
'Plus, the text boxes that I created on the form with the names
show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO >
11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I
created
a
form
in the Northwind database with 18 text boxes in a grid of 6
columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need
to be
written
that would loop through the controls on the form and either
update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " &
_
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or
intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder)
=
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub


--
Duane Hookom
MS Access MVP


in
message
Duane...
As far as I know, I have no limit on the number of columns
created
in
the
crosstab.
although, I do know the approximate limit to its use in this
application...of the twelve months the average additional odd
dates
would
be
three additional per month...give or take a few. Some months
will
have
more
than three others none. The way their calendar works
7/1/2005 is
really a
June date and 7/31/2005 is really an August date. As it
stands
now
10/30/2005 & 10/31/2005 are the only two for November and
11/26/2005 is
the
only date for December. These dates are dynamic in that all
dates
after
the
current date are subject to the addition of another date
before
the
year
ends.
I am not familiar with "unbound" forms... I have always used
forms
bound
to
queries or tables. I just tried to create an unbound form
with
text
boxes
as
you said...(of course, my text boxes are referencing tables
EX:
=[GROUP
Crosstab MAKE TABLE]![Item #]). However, the expressions
come
back
with
#Name?... Should I be entering the code into the SQL view?
Or am
I
using
the wrong syntax? Could you give me an example of what you
are
talking
about?

I appreciate your help and just because I'm addicted doesn't
mean
that
I
know everything...LOL I'm addicted to the learning of
it...I'm a
"can't
stop
 
A

AccessAddict

Thank you...sorry for the oversight...I guess I thought you put the quotation
marks there to tell me to insert the name of my table. I also noticed them
in the strSQL - but kept them for some reason. I am not familiar with string
logic...therefore, yes, I am learning.

Thanks.

I am not out of the woods yet...but as you may have guessed from an earlier
thread...I have some correcting to do. As it turns out, first I used labels
instead of text boxes, then, I didn't put the names in the tab other under
name...I put it under the data tab in the control source box. I had a bad
day Friday...locked my keys in the car twice...so it does not surprise me
that I did this Friday as well. I am still correcting the text boxes...but
wanted to let you know that I appreciate all that you have helped me with.

I'll be back...I'm sure...but not today...

Have a good one!

Duane Hookom said:
My code from earlier reply:
strCustomer = .Fields("CompanyName")
Your code:
strItem=.fields(SUPSUBFL)

Note the difference?

--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I apologize for the fact that these are syntax errors...I will get it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over the
word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


AccessAddict said:
Thanks Duane...my first instinct was to add the brackets, but since I am
not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used to...

:

If you use spaces and punctuation, you must wrap your object names in
[ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

message
I just tried to change a table name...of course, it doesn't change in
all
the
places that I have used it. Since I see that this is a big job, I
will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I guess
I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed
that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I
expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form)
disappear
when
I get the code (which fills them) correct? ... or is that an
entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much
of
this
thread has had much to do with Pivot Tables...LOL...although the
final
layout
will be like a Pivot Table...but editable and updatable. Since this
is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back
for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to

inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING
TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST
OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off
Price'
'Plus, the text boxes that I created on the form with the names
show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO >
11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I
created
a
form
in the Northwind database with 18 text boxes in a grid of 6
columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need
to be
written
that would loop through the controls on the form and either
update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " &
_
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer <> .Fields("CompanyName") Or
intOrder >
4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder)
=
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub
 
A

AccessAddict

Duane...
I am back. Of course, needing help. I apologize for the length of this
stream.

Here's where I am. I only want one group (SUPSUBFL) at a time, to show on
this form.

Therefore, I have adjusted the code for that purpose. It (sort of) worked
but because of the incrementation of the integer field used to fill in the
body of the form, it just strung them across the form (one after the other)
and not in the specific columns that I wanted.
I want the value of (Post Off Price) to populate the body according to the
(Post Off Start Date).
I adjusted the code to use the field (Post Off Start Date) in the text boxes
and named each text box accordingly "txtPO1_1/2/2005", "txtPO2_1/2/2005, etc.


The group header works as does the txtItems fields down the first column.
When I get this code working, I will use an adjusted copy of it to clear the
form for a new group.
Also, the form only lets me put enough controls on it for half of the year
so I added the following if statements (expecting to code another button the
same for the second half of the year):

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then hldPOST =
..Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post Off Price]")

The body of the form does not work. The error I get is "cannot find the
field txtPO_12:00:00 AM referred to in your expression" . The txtPO_(field)
should be the date - not the time. How do I code the form to only include
mmddyyyy? Or do you have another idea?

Below is the actual code:

Private Sub UpdateGroup_Click()
On Error GoTo Err_UpdateGroup_Click

Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim strSQL As String
Dim intITEM As Integer
Dim hldITEM As String
Dim intGroup As String
Dim hldGroup As String
Dim hldPOST As Date


strSQL = "SELECT [SUPSUBFL],[Post Off Start Date],[Post Off Price],[N POST
OFF TABLE].[Item #] FROM [N ITEM PRICING TABLE]INNER JOIN[N Post Off
Table]ON[N item Pricing Table].[Item #]=[N POST OFF TABLE].[Item #] ORDER BY
[SUPSUBFL],[Post Off Start Date]"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs

intGroup = 0
intITEM = 0

hldGroup = .Fields("SUPSUBFL")
hldITEM = .Fields("[Item #]")


Do Until .EOF Or hldGroup <> .Fields("SUPSUBFL")

Me("txtGroup") = hldGroup

intGroup = intGroup + 1

.MoveNext

Do Until .EOF Or intITEM > 19

intITEM = intITEM + 1
hldITEM = .Fields("[Item #]")

Me("txtITEM" & intITEM) = hldITEM

.MoveNext

Do Until hldGroup <> .Fields("SUPSUBFL") Or .EOF

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then
hldPOST = .Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post
Off Price]")

.MoveNext
Loop
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing


Exit_UpdateGroup_Click:
Exit Sub

Err_UpdateGroup_Click:
MsgBox Err.Description
Resume Exit_UpdateGroup_Click

End Sub

AccessAddict said:
Thank you...sorry for the oversight...I guess I thought you put the quotation
marks there to tell me to insert the name of my table. I also noticed them
in the strSQL - but kept them for some reason. I am not familiar with string
logic...therefore, yes, I am learning.

Thanks.

I am not out of the woods yet...but as you may have guessed from an earlier
thread...I have some correcting to do. As it turns out, first I used labels
instead of text boxes, then, I didn't put the names in the tab other under
name...I put it under the data tab in the control source box. I had a bad
day Friday...locked my keys in the car twice...so it does not surprise me
that I did this Friday as well. I am still correcting the text boxes...but
wanted to let you know that I appreciate all that you have helped me with.

I'll be back...I'm sure...but not today...

Have a good one!

Duane Hookom said:
My code from earlier reply:
strCustomer = .Fields("CompanyName")
Your code:
strItem=.fields(SUPSUBFL)

Note the difference?

--
Duane Hookom
MS Access MVP
--

AccessAddict said:
I apologize for the fact that these are syntax errors...I will get it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over the
word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


:

Thanks Duane...my first instinct was to add the brackets, but since I am
not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used to...

:

If you use spaces and punctuation, you must wrap your object names in
[ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " & _
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

message
I just tried to change a table name...of course, it doesn't change in
all
the
places that I have used it. Since I see that this is a big job, I
will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I guess
I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in the
queries,
forms, reports, etc.? I am used to using Access 97...I have noticed
that
in
Access 2003...I did change a name and it surprised me and changed
someplace
automatically...but does it change in all places? ...or should I
expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form)
disappear
when
I get the code (which fills them) correct? ... or is that an
entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not much
of
this
thread has had much to do with Pivot Tables...LOL...although the
final
layout
will be like a Pivot Table...but editable and updatable. Since this
is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in your
object
names.

Figure out how to fix this. If you can't find the fix, come back
for an
answer.

--
Duane Hookom
MS Access MVP


message
Duane...
I created a form with 20 rows and 36 columns - formatted as you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to

inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS PRICING
TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N POST
OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post Off
Price'
'Plus, the text boxes that I created on the form with the names
show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO >
11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex. I
created
a
form
in the Northwind database with 18 text boxes in a grid of 6
columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a recordset and
places
customers and order dates into the text boxes. Code would need
to be
written
that would loop through the controls on the form and either
update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " &
_
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
 
D

Duane Hookom

This is more than I bargained for. My text boxes didn't have a date in the
control names. They used an integer value that was incremented in the
looping code.

--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
I am back. Of course, needing help. I apologize for the length of this
stream.

Here's where I am. I only want one group (SUPSUBFL) at a time, to show on
this form.

Therefore, I have adjusted the code for that purpose. It (sort of) worked
but because of the incrementation of the integer field used to fill in the
body of the form, it just strung them across the form (one after the
other)
and not in the specific columns that I wanted.
I want the value of (Post Off Price) to populate the body according to the
(Post Off Start Date).
I adjusted the code to use the field (Post Off Start Date) in the text
boxes
and named each text box accordingly "txtPO1_1/2/2005", "txtPO2_1/2/2005,
etc.


The group header works as does the txtItems fields down the first column.
When I get this code working, I will use an adjusted copy of it to clear
the
form for a new group.
Also, the form only lets me put enough controls on it for half of the year
so I added the following if statements (expecting to code another button
the
same for the second half of the year):

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then hldPOST =
.Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post Off Price]")

The body of the form does not work. The error I get is "cannot find the
field txtPO_12:00:00 AM referred to in your expression" . The
txtPO_(field)
should be the date - not the time. How do I code the form to only include
mmddyyyy? Or do you have another idea?

Below is the actual code:

Private Sub UpdateGroup_Click()
On Error GoTo Err_UpdateGroup_Click

Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim strSQL As String
Dim intITEM As Integer
Dim hldITEM As String
Dim intGroup As String
Dim hldGroup As String
Dim hldPOST As Date


strSQL = "SELECT [SUPSUBFL],[Post Off Start Date],[Post Off Price],[N POST
OFF TABLE].[Item #] FROM [N ITEM PRICING TABLE]INNER JOIN[N Post Off
Table]ON[N item Pricing Table].[Item #]=[N POST OFF TABLE].[Item #] ORDER
BY
[SUPSUBFL],[Post Off Start Date]"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs

intGroup = 0
intITEM = 0

hldGroup = .Fields("SUPSUBFL")
hldITEM = .Fields("[Item #]")


Do Until .EOF Or hldGroup <> .Fields("SUPSUBFL")

Me("txtGroup") = hldGroup

intGroup = intGroup + 1

.MoveNext

Do Until .EOF Or intITEM > 19

intITEM = intITEM + 1
hldITEM = .Fields("[Item #]")

Me("txtITEM" & intITEM) = hldITEM

.MoveNext

Do Until hldGroup <> .Fields("SUPSUBFL") Or .EOF

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then
hldPOST = .Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post
Off Price]")

.MoveNext
Loop
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing


Exit_UpdateGroup_Click:
Exit Sub

Err_UpdateGroup_Click:
MsgBox Err.Description
Resume Exit_UpdateGroup_Click

End Sub

AccessAddict said:
Thank you...sorry for the oversight...I guess I thought you put the
quotation
marks there to tell me to insert the name of my table. I also noticed
them
in the strSQL - but kept them for some reason. I am not familiar with
string
logic...therefore, yes, I am learning.

Thanks.

I am not out of the woods yet...but as you may have guessed from an
earlier
thread...I have some correcting to do. As it turns out, first I used
labels
instead of text boxes, then, I didn't put the names in the tab other
under
name...I put it under the data tab in the control source box. I had a
bad
day Friday...locked my keys in the car twice...so it does not surprise me
that I did this Friday as well. I am still correcting the text
boxes...but
wanted to let you know that I appreciate all that you have helped me
with.

I'll be back...I'm sure...but not today...

Have a good one!

Duane Hookom said:
My code from earlier reply:
strCustomer = .Fields("CompanyName")
Your code:
strItem=.fields(SUPSUBFL)

Note the difference?

--
Duane Hookom
MS Access MVP
--

message
I apologize for the fact that these are syntax errors...I will get
it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that
field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over
the
word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


:

Thanks Duane...my first instinct was to add the brackets, but since
I am
not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used
to...

:

If you use spaces and punctuation, you must wrap your object names
in
[ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " &
_
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I
haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

message
I just tried to change a table name...of course, it doesn't
change in
all
the
places that I have used it. Since I see that this is a big job,
I
will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I
guess
I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in
the
queries,
forms, reports, etc.? I am used to using Access 97...I have
noticed
that
in
Access 2003...I did change a name and it surprised me and
changed
someplace
automatically...but does it change in all places? ...or should
I
expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form)
disappear
when
I get the code (which fills them) correct? ... or is that an
entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not
much
of
this
thread has had much to do with Pivot Tables...LOL...although
the
final
layout
will be like a Pivot Table...but editable and updatable. Since
this
is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in
your
object
names.

Figure out how to fix this. If you can't find the fix, come
back
for an
answer.

--
Duane Hookom
MS Access MVP


in
message
Duane...
I created a form with 20 rows and 36 columns - formatted as
you
suggested
except:
The name intCustomer is replaced with the name intITEM
strCustomer is replaced with the name strITEM
intOrder is replaced with the name intPO
txtCust is replaced with txtITEM
txtOrdDate is replaced with txtPOPrice

below is the code from my button...
----------
Private Sub Command3191_Click()
On Error GoTo Err_Command3191_Click


DoCmd.GoToRecord , , acFirst

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intITEM As Integer
Dim strITEM As String
Dim intPO As Integer

' Select the [field],[field] from
joined to

inner
join
.[key field]
'
.[first-key field of a combo-field-key field]

strSQL = "SELECT SUPSUBFL, Post Off Price, FROM N ITEMS
PRICING
TABLE
INNER
JOIN N Post Off Table ON N items Pricing Table.Item # = N
POST
OFF
TABLE.Item
# ORDER BY SUPSUBFL, Post Off Price"

' SUPSUBFL
' POST OFF PRICE
' N ITEMS PRICING TABLE
' N POST OFF TABLE
' N ITEMS PRICING TABLE.Item #
' N POST OFF TABLE.Item #
' sort by SUPSUBFL, POST OFF PRICE

' The syntax won't let me past this point...
' I get the error:

'Run-Time error '3075'
'Syntax error (missing operator) in query expression 'Post
Off
Price'
'Plus, the text boxes that I created on the form with the
names
show
#Name
in all of
'them.

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs
intITEM = 0
Do Until .EOF Or intITEM > 4152
strITEM = .Fields(SUPSUBFL)
intITEM = intITEM + 1
Me("txtITEM" & intITEM) = strITEM
intPO = 0

'This code groups by SUPSUBFL

Do Until strITEM <> .Fields(SUPSUBFL) Or intPO >
11952
intPO = intPO + 1
Me("txtPOPrice" & intITEM & "_" & intPO) =
.Fields("Post
Off
Price")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing

Exit_Command3191_Click:
Exit Sub

Err_Command3191_Click:
MsgBox Err.Description
Resume Exit_Command3191_Click

End Sub
---------------

Thanks again Duane for your time...


:

This might be a bit complex but your question is complex.
I
created
a
form
in the Northwind database with 18 text boxes in a grid of
6
columns
and 3
rows. The first column text boxes have the names of:
txtCust1 - txtCust3
The 2 - 6 text boxes of the first row have names like:
txtOrdDate1_1 - txtOrdDate1_5
The 2 - 6 text boxes of the second row have names like:
txtOrdDate2_1 - txtOrdDate2_5
The 2 - 6 text boxes of the third row have names like:
txtOrdDate3_1 - txtOrdDate3_5

I added a command button on the form that opens a
recordset and
places
customers and order dates into the text boxes. Code would
need
to be
written
that would loop through the controls on the form and
either
update
or
append
records back to the table(s).

Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID =
Orders.CustomerID " &
_
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer > 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
 
A

AccessAddict

LOL...I understand, so you see my dilema...I understand, as well, if you want
to bow out...this is a lot to ask of anyone, except myself.

I have managed to move along a little further since that last stream...and I
did get the date in the string...and the data moves across from the item #
through the dates and fills in the form and (almost) in the correct
places...I'm still working on it. The first one has the wrong amount in the
right place, then it doesn't put an amount in the 1/30/2005 spot that it
should (although, at one point it did - I lost it), then I changed the last
column to accept a date that was out of range - because it doesn't seem to
recognize my "if" statements and says it can't find that date - and it puts
the correct amount in for that date. I changed the name of that last
textbox..to move it along and see what would happen. I will eventually
change it back and have a second button with the code for the second half of
the year (unless you can help me get more text boxes on one form-LOL).

It doesn't seem to be handling the first record, because it is putting the
wrong amount in the first spot (1/2/2005). I don't seem to have control of
the data. I have sorted the tables the way I want and used them in the SQL
statement then I tried to join the tables in a query and use that in the
SQL...to no avail. I will probably go back and forth with this concept until
I get it right - I did have it a little closer in this area at one time
before I got the string date value working.

I will list my code and you can see how I handled the date value string - I
probably have some logic problems as well:

Private Sub UpdateGroup_Click()
On Error GoTo Err_UpdateGroup_Click

Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim strSQL As String
Dim intITEM As Integer
Dim hldITEM As String
Dim intGroup As Integer
Dim hldGroup As String
Dim hldPOST As String
'Dim S As String
'Dim P As String


'strSQL = "SELECT [SUPSUBFL],[Post Off Start Date],[Post Off Price],[N POST
OFF TABLE].[Item #] FROM [N ITEM PRICING TABLE]INNER JOIN[N Post Off
Table]ON[N item Pricing Table].[Item #]=[N POST OFF TABLE].[Item #] ORDER BY
[SUPSUBFL],[Post Off Start Date]"
strSQL = "SELECT [SUPSUBFL],[Post Off Start Date],[Post Off Price],[Grouping
Post Off Query].[Item #] from [Grouping Post Off Query] ORDER BY
[SUPSUBFL],[Post Off Start Date]"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

'rs.MoveFirst
With rs

intGroup = 0
intITEM = 0

hldGroup = .Fields("SUPSUBFL")
hldITEM = .Fields("[Item #]")


'Do Until .EOF Or hldGroup <> .Fields("SUPSUBFL")
Do Until hldITEM <> .Fields("[Item #]") Or .EOF
Me("txtGroup") = hldGroup

intGroup = intGroup + 1
intITEM = intITEM + 1
.MoveNext

' Do Until .EOF Or hldITEM <> .Fields("[Item #]") Or intITEM > 19
' Do Until .EOF Or intITEM > 19
Do Until .EOF Or hldGroup <> .Fields("SUPSUBFL")
hldITEM = .Fields("[Item #]")

Me("txtITEM" & intITEM) = hldITEM

.MoveNext

'Do Until hldGroup <> .Fields("SUPSUBFL") Or .EOF
Do Until hldITEM <> .Fields("Item #") Or .EOF
If (.Fields("[Post Off Start Date]") > #6/4/2005#) Then
..MoveNext Else hldPOST = .Fields("[Post Off Start Date]")

If (hldPOST = " ") Then .MoveNext

' S = Str$(.Fields("[Post Off Start Date]"))
' P = Str$(.Fields("[Post Off Price]"))

hldPOST = Str$(.Fields("[Post Off Start Date]"))
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post
Off Price]")


.MoveNext
Loop
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing



Exit_UpdateGroup_Click:
Exit Sub

Err_UpdateGroup_Click:
MsgBox Err.Description
Resume Exit_UpdateGroup_Click
End Sub



Duane Hookom said:
This is more than I bargained for. My text boxes didn't have a date in the
control names. They used an integer value that was incremented in the
looping code.

--
Duane Hookom
MS Access MVP


AccessAddict said:
Duane...
I am back. Of course, needing help. I apologize for the length of this
stream.

Here's where I am. I only want one group (SUPSUBFL) at a time, to show on
this form.

Therefore, I have adjusted the code for that purpose. It (sort of) worked
but because of the incrementation of the integer field used to fill in the
body of the form, it just strung them across the form (one after the
other)
and not in the specific columns that I wanted.
I want the value of (Post Off Price) to populate the body according to the
(Post Off Start Date).
I adjusted the code to use the field (Post Off Start Date) in the text
boxes
and named each text box accordingly "txtPO1_1/2/2005", "txtPO2_1/2/2005,
etc.


The group header works as does the txtItems fields down the first column.
When I get this code working, I will use an adjusted copy of it to clear
the
form for a new group.
Also, the form only lets me put enough controls on it for half of the year
so I added the following if statements (expecting to code another button
the
same for the second half of the year):

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then hldPOST =
.Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post Off Price]")

The body of the form does not work. The error I get is "cannot find the
field txtPO_12:00:00 AM referred to in your expression" . The
txtPO_(field)
should be the date - not the time. How do I code the form to only include
mmddyyyy? Or do you have another idea?

Below is the actual code:

Private Sub UpdateGroup_Click()
On Error GoTo Err_UpdateGroup_Click

Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim strSQL As String
Dim intITEM As Integer
Dim hldITEM As String
Dim intGroup As String
Dim hldGroup As String
Dim hldPOST As Date


strSQL = "SELECT [SUPSUBFL],[Post Off Start Date],[Post Off Price],[N POST
OFF TABLE].[Item #] FROM [N ITEM PRICING TABLE]INNER JOIN[N Post Off
Table]ON[N item Pricing Table].[Item #]=[N POST OFF TABLE].[Item #] ORDER
BY
[SUPSUBFL],[Post Off Start Date]"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

rs.MoveFirst
With rs

intGroup = 0
intITEM = 0

hldGroup = .Fields("SUPSUBFL")
hldITEM = .Fields("[Item #]")


Do Until .EOF Or hldGroup <> .Fields("SUPSUBFL")

Me("txtGroup") = hldGroup

intGroup = intGroup + 1

.MoveNext

Do Until .EOF Or intITEM > 19

intITEM = intITEM + 1
hldITEM = .Fields("[Item #]")

Me("txtITEM" & intITEM) = hldITEM

.MoveNext

Do Until hldGroup <> .Fields("SUPSUBFL") Or .EOF

If (.Fields("[Post Off Start Date]") < #6/5/2005#) Then
hldPOST = .Fields("[Post Off Start Date]") Else .MoveNext
If (hldPOST = 0) Then .MoveNext
Me("txtPO" & intITEM & "_" & hldPOST) = .Fields("[Post
Off Price]")

.MoveNext
Loop
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing


Exit_UpdateGroup_Click:
Exit Sub

Err_UpdateGroup_Click:
MsgBox Err.Description
Resume Exit_UpdateGroup_Click

End Sub

AccessAddict said:
Thank you...sorry for the oversight...I guess I thought you put the
quotation
marks there to tell me to insert the name of my table. I also noticed
them
in the strSQL - but kept them for some reason. I am not familiar with
string
logic...therefore, yes, I am learning.

Thanks.

I am not out of the woods yet...but as you may have guessed from an
earlier
thread...I have some correcting to do. As it turns out, first I used
labels
instead of text boxes, then, I didn't put the names in the tab other
under
name...I put it under the data tab in the control source box. I had a
bad
day Friday...locked my keys in the car twice...so it does not surprise me
that I did this Friday as well. I am still correcting the text
boxes...but
wanted to let you know that I appreciate all that you have helped me
with.

I'll be back...I'm sure...but not today...

Have a good one!

:

My code from earlier reply:
strCustomer = .Fields("CompanyName")
Your code:
strItem=.fields(SUPSUBFL)

Note the difference?

--
Duane Hookom
MS Access MVP
--

message
I apologize for the fact that these are syntax errors...I will get
it...

It doesn't like this statement is this syntax correct?:

strItem=.fields(SUPSUBFL)

as I run my cursor over the text SUPSUBFL it shows data for that
field
yet, I get the error '3265' - Item not found in this collection
this error description does shows, though, as I run the cursor over
the
word
"fields"

SUPSUBFL shows as:
SUPSUBFL="E&J Gallo Winery/Burlwood/44.1" this data is correct.


:

Thanks Duane...my first instinct was to add the brackets, but since
I am
not
as familiar with VB and SQL, I thought you might not be able to do
that...this will be much easier...since this is the way I'm used
to...

:

If you use spaces and punctuation, you must wrap your object names
in
[ ]s.
strSQL = "SELECT SUPSUBFL, [Post Off Price] " & _
"FROM [N ITEMS PRICING TABLE] INNER JOIN " & _
"[N Post Off Table] ON [N items Pricing Table].[Item #] = " &
_
"[N POST OFF TABLE].[Item #] " & _
"ORDER BY SUPSUBFL, [Post Off Price]"
You had an extra comma to the left of "FROM" which I removed. I
haven't
check the remainder of your code or logic (baby steps).
--
Duane Hookom
MS Access MVP
--

message
I just tried to change a table name...of course, it doesn't
change in
all
the
places that I have used it. Since I see that this is a big job,
I
will
wait
for your response to see if there is an easier way... :-( .

:

I should know better than that...but since Access lets you...I
guess
I
decided, at some point, to wait until something like this
happened...before
giving up the descriptive names.

Question #1:
If I change the names in my tables, will it change the names in
the
queries,
forms, reports, etc.? I am used to using Access 97...I have
noticed
that
in
Access 2003...I did change a name and it surprised me and
changed
someplace
automatically...but does it change in all places? ...or should
I
expect
more
problems?

Question #2:
Will the "#Name" (which shows in the text boxes on the form)
disappear
when
I get the code (which fills them) correct? ... or is that an
entirely
different problem?

Comment:
I guess I named this question incorrectly as well...so far not
much
of
this
thread has had much to do with Pivot Tables...LOL...although
the
final
layout
will be like a Pivot Table...but editable and updatable. Since
this
is a
forum to help others, should I try to change the name of this
question...or
is that not do-able?

Thanks...Donna



:

You are being punished for allowing spaces and punctuation in
your
object
names.

Figure out how to fix this. If you can't find the fix, come
back
 
Top