PC Review


Reply
Thread Tools Rate Thread

convert layout

 
 
=?Utf-8?B?SyBDbGF1YmVyZw==?=
Guest
Posts: n/a
 
      7th Nov 2006
I have a table with the following field names:

Code Date Dept1 Dept2 Dept3 Dept4.....Dept 30
123 10/1 3258 8751
345 10/6 5587


The "Code" field is a unique record and the values for each of the "DeptN"
fields are numeric. I would like to convert this table so there is a
different record for each DeptN value. For instance:

Code Date Dept Value
123 10/1 Dept1 3258
123 10/1 Dept2 8751
345 10/6 Dept3 5587

Can this be accomplished with a query? Any help is greatly appreciated.

Kevin C.
 
Reply With Quote
 
 
 
 
Jim Bunton
Guest
Posts: n/a
 
      7th Nov 2006
I don't think this is possible with one single query.

However you can do it by using a subroutine.to transfer the old data tyo a
new table
First create a new table e.g.
DeptCodes
------------
DeptCodeId Counter Key
Dept Integer(?) {unique
Code Integer(?) index}
dcDate DateTime [how meaningful is this - is it always the same
for each code?]
-------------

Sub BuildNewTable() ' in pigeon basic! it's a while since!
dim ncols as integer
openrecordset Olddata read only for original table
OldData.movefirst
openrecordset NewData dynaset for New Table
nCols = [number of columns in your original table]
while not OldData.eof
for colno = 2 to nCols -1 [because the first column is numbered 0]
if not isnull(OldData.field(colno)) then
add a record to the new table
col 1 = oldset.field(colno)
col 2 = oldset.fileds(0)
col 3 = oldset filed(1)
end if
next
OldData.movenext
wend
close the recordsets etc
end

check the new data!



"K Clauberg" <(E-Mail Removed)> wrote in message
news:17EAE685-10E6-4621-AD31-(E-Mail Removed)...
> I have a table with the following field names:
>
> Code Date Dept1 Dept2 Dept3 Dept4.....Dept 30
> 123 10/1 3258 8751
> 345 10/6 5587
>
>
> The "Code" field is a unique record and the values for each of the "DeptN"
> fields are numeric. I would like to convert this table so there is a
> different record for each DeptN value. For instance:
>
> Code Date Dept Value
> 123 10/1 Dept1 3258
> 123 10/1 Dept2 8751
> 345 10/6 Dept3 5587
>
> Can this be accomplished with a query? Any help is greatly appreciated.
>
> Kevin C.



 
Reply With Quote
 
Jim Bunton
Guest
Posts: n/a
 
      9th Nov 2006
I don't think this is possible with one single query.

However you can do it by using a subroutine.to transfer the old data tyo a
new table
First create a new table e.g.
DeptCodes
------------
DeptCodeId Counter Key
Dept Integer(?) {unique
Code Integer(?) index}
dcDate DateTime [how meaningful is this - is it always the same
for each code?]
-------------

Sub BuildNewTable() ' in pigeon basic! it's a while since!
dim ncols as integer
openrecordset Olddata read only for original table
OldData.movefirst
openrecordset NewData dynaset for New Table
nCols = [number of columns in your original table]
while not OldData.eof
for colno = 2 to nCols -1 [because the first column is numbered 0]
if not isnull(OldData.field(colno)) then
add a record to the new table
col 1 = oldset.field(colno)
col 2 = oldset.fileds(0)
col 3 = oldset filed(1)
end if
next
OldData.movenext
wend
close the recordsets etc
end

check the new data!

Jim

"K Clauberg" <(E-Mail Removed)> wrote in message
news:17EAE685-10E6-4621-AD31-(E-Mail Removed)...
> I have a table with the following field names:
>
> Code Date Dept1 Dept2 Dept3 Dept4.....Dept 30
> 123 10/1 3258 8751
> 345 10/6 5587
>
>
> The "Code" field is a unique record and the values for each of the "DeptN"
> fields are numeric. I would like to convert this table so there is a
> different record for each DeptN value. For instance:
>
> Code Date Dept Value
> 123 10/1 Dept1 3258
> 123 10/1 Dept2 8751
> 345 10/6 Dept3 5587
>
> Can this be accomplished with a query? Any help is greatly appreciated.
>
> Kevin C.



"K Clauberg" <(E-Mail Removed)> wrote in message
news:17EAE685-10E6-4621-AD31-(E-Mail Removed)...
> I have a table with the following field names:
>
> Code Date Dept1 Dept2 Dept3 Dept4.....Dept 30
> 123 10/1 3258 8751
> 345 10/6 5587
>
>
> The "Code" field is a unique record and the values for each of the "DeptN"
> fields are numeric. I would like to convert this table so there is a
> different record for each DeptN value. For instance:
>
> Code Date Dept Value
> 123 10/1 Dept1 3258
> 123 10/1 Dept2 8751
> 345 10/6 Dept3 5587
>
> Can this be accomplished with a query? Any help is greatly appreciated.
>
> Kevin C.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool to convert formulas in readable layout X-Ray Microsoft Excel Discussion 2 24th Sep 2008 12:11 PM
Convert address label layout to csv format Mailer Microsoft Excel Misc 0 25th Nov 2007 10:13 PM
Convert layout of data =?Utf-8?B?SmVuTA==?= Microsoft Access Database Table Design 2 3rd Mar 2006 06:00 PM
Powerpoint to PDF page layout problem when using the Convert to Adobe PDF macro DocA Microsoft Powerpoint 10 26th Apr 2004 04:31 PM
I need a macro to convert my date formats into a custom layout. Martyn Microsoft Excel Programming 4 25th Feb 2004 12:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 PM.