A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"pivoting" data with a querry



 
 
Thread Tools Display Modes
  #1  
Old August 23rd, 2005, 08:34 PM
jay
external usenet poster
 
Posts: n/a
Default "pivoting" data with a querry

All,

I've got a table as follows:

[ItemNumber] [Supplier1] [Supplier2] [Supplier3] [Supplier4]
[Supplier5]

I need to generate a combo-box listing each of the five suppliers for an
Item Number. I've considered something like

[combo].[additem] dlookup (ItemNumber, Supplier1) - forgive the bad
programming!

but it seems a bit intensive for some low spec workstations

Is it possible to create a querry to base the combo box on?

thanks in advance

Jay Hallsworth



  #2  
Old August 23rd, 2005, 09:07 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

You shouldn't have 5 supplier fields. This isn't normalized. Can you change
your data structures to have a table with fields and records like:

ItemNumber SupplierID
A 1
A 2
A 7
B 1
B 4

This kind of setup allows any number of suppliers per ItemNumber and makes
your combo box a piece of cake.

--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
All,

I've got a table as follows:

[ItemNumber] [Supplier1] [Supplier2] [Supplier3] [Supplier4]
[Supplier5]

I need to generate a combo-box listing each of the five suppliers for an
Item Number. I've considered something like

[combo].[additem] dlookup (ItemNumber, Supplier1) - forgive the bad
programming!

but it seems a bit intensive for some low spec workstations

Is it possible to create a querry to base the combo box on?

thanks in advance

Jay Hallsworth





  #3  
Old August 23rd, 2005, 09:22 PM
jay
external usenet poster
 
Posts: n/a
Default

Hi Duane,

Many thanks for your reply.

If only ... I've been thinking that ever since I've started looking at the
table! ... unfortunately the table isn't mine, it's actually a table I'm
getting from Sage Line100. I'm constantly in bewilderment as to the logic of
Sage's programming!

Regards,

Jay



"Duane Hookom" wrote in message
...
You shouldn't have 5 supplier fields. This isn't normalized. Can you
change your data structures to have a table with fields and records like:

ItemNumber SupplierID
A 1
A 2
A 7
B 1
B 4

This kind of setup allows any number of suppliers per ItemNumber and makes
your combo box a piece of cake.

--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
All,

I've got a table as follows:

[ItemNumber] [Supplier1] [Supplier2] [Supplier3] [Supplier4]
[Supplier5]

I need to generate a combo-box listing each of the five suppliers for an
Item Number. I've considered something like

[combo].[additem] dlookup (ItemNumber, Supplier1) - forgive the bad
programming!

but it seems a bit intensive for some low spec workstations

Is it possible to create a querry to base the combo box on?

thanks in advance

Jay Hallsworth







  #4  
Old August 23rd, 2005, 10:13 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

You can use a union query to normalize your data:
SELECT ItemNumber, Supplier1 as Supplier, 1 as SupNum
FROM tblSageSpreadsheet
UNION ALL

SELECT ItemNumber, Supplier2,2
FROM tblSageSpreadsheet
WHERE Supplier2 is not null
UNION ALL

SELECT ItemNumber, Supplier3, 3
FROM tblSageSpreadsheet
WHERE Supplier3 is not null
UNION ALL
--- etc ---;


--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
Hi Duane,

Many thanks for your reply.

If only ... I've been thinking that ever since I've started looking at the
table! ... unfortunately the table isn't mine, it's actually a table I'm
getting from Sage Line100. I'm constantly in bewilderment as to the logic
of Sage's programming!

Regards,

Jay



"Duane Hookom" wrote in message
...
You shouldn't have 5 supplier fields. This isn't normalized. Can you
change your data structures to have a table with fields and records like:

ItemNumber SupplierID
A 1
A 2
A 7
B 1
B 4

This kind of setup allows any number of suppliers per ItemNumber and
makes your combo box a piece of cake.

--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
All,

I've got a table as follows:

[ItemNumber] [Supplier1] [Supplier2] [Supplier3] [Supplier4]
[Supplier5]

I need to generate a combo-box listing each of the five suppliers for an
Item Number. I've considered something like

[combo].[additem] dlookup (ItemNumber, Supplier1) - forgive the bad
programming!

but it seems a bit intensive for some low spec workstations

Is it possible to create a querry to base the combo box on?

thanks in advance

Jay Hallsworth









  #5  
Old August 24th, 2005, 12:56 AM
jay
external usenet poster
 
Posts: n/a
Default

Duane,

Many thanks for your help, mission acomplished ... eventually

I created a make table query from the Sage Line100 ODBC datasource (had to
do this because the union query returned ODBC errors if run directly on the
ODBC datasource) I then created a union query to normalise the table as you
suggested, then created a select query to filter out the ItemNumber I
required and based the combo box row source on that by updating it when
loosing focus on the ItemNumber field on the form.

Still got a bit of work to do writing a macro to re-query the union, but it
should be pretty streight forward from here on in

thanks once again for your help

regards,

Jay




"Duane Hookom" wrote in message
...
You can use a union query to normalize your data:
SELECT ItemNumber, Supplier1 as Supplier, 1 as SupNum
FROM tblSageSpreadsheet
UNION ALL

SELECT ItemNumber, Supplier2,2
FROM tblSageSpreadsheet
WHERE Supplier2 is not null
UNION ALL

SELECT ItemNumber, Supplier3, 3
FROM tblSageSpreadsheet
WHERE Supplier3 is not null
UNION ALL
--- etc ---;


--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
Hi Duane,

Many thanks for your reply.

If only ... I've been thinking that ever since I've started looking at
the table! ... unfortunately the table isn't mine, it's actually a table
I'm getting from Sage Line100. I'm constantly in bewilderment as to the
logic of Sage's programming!

Regards,

Jay



"Duane Hookom" wrote in message
...
You shouldn't have 5 supplier fields. This isn't normalized. Can you
change your data structures to have a table with fields and records
like:

ItemNumber SupplierID
A 1
A 2
A 7
B 1
B 4

This kind of setup allows any number of suppliers per ItemNumber and
makes your combo box a piece of cake.

--
Duane Hookom
MS Access MVP
--

"jay" wrote in message
...
All,

I've got a table as follows:

[ItemNumber] [Supplier1] [Supplier2] [Supplier3]
[Supplier4] [Supplier5]

I need to generate a combo-box listing each of the five suppliers for
an Item Number. I've considered something like

[combo].[additem] dlookup (ItemNumber, Supplier1) - forgive the bad
programming!

but it seems a bit intensive for some low spec workstations

Is it possible to create a querry to base the combo box on?

thanks in advance

Jay Hallsworth











 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save an access document in word document? cmartin General Discussion 2 September 13th, 2005 11:26 PM
Unable to have multiple queries feeding a single report PZ Straube Setting Up & Running Reports 15 June 15th, 2005 08:16 AM
Data Source issues. ??data.access.pages Phil Database Design 2 October 11th, 2004 02:42 AM
Data Source issues Philippe Database Design 1 October 10th, 2004 09:45 PM
How to create graphs in a monthly report where the base data can change John Clarke Charts and Charting 3 June 25th, 2004 02:22 AM


All times are GMT +1. The time now is 08:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.