PC Review


Reply
Thread Tools Rate Thread

Convert Excel Sheet to Table

 
 
Wahab
Guest
Posts: n/a
 
      7th Sep 2008
Hi
Pls. help me to convert my Excel sheet into access Table by writing
recordset. Sheet is some how like this:
Code Kwt Bhn Qtr
USD 0.268 0.377 3.643
BHD 0.710 1.000 9.654
DKK 0.053 0.073 0.717
I want to convert with access table (TblCurrency) in this way:
Country Code Rate
Kwt USD 0.268
Kwt BHD 0.710
Kwt DKK 0.053
Bhn USD 0.377
Bhn BHD 1.000
Bhn DKK 0.073
Qtr USD 3.643
Qtr BHD 9.654
Qtr DKK 0.717
please show me how i will write recordset to convert Excel sheet
thanks


 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      7th Sep 2008
On Sun, 7 Sep 2008 00:50:06 -0700, Wahab <(E-Mail Removed)>
wrote:

>Hi
>Pls. help me to convert my Excel sheet into access Table by writing
>recordset. Sheet is some how like this:
>Code Kwt Bhn Qtr
>USD 0.268 0.377 3.643
>BHD 0.710 1.000 9.654
>DKK 0.053 0.073 0.717
>I want to convert with access table (TblCurrency) in this way:
>Country Code Rate
>Kwt USD 0.268
>Kwt BHD 0.710
>Kwt DKK 0.053
>Bhn USD 0.377
>Bhn BHD 1.000
>Bhn DKK 0.073
>Qtr USD 3.643
>Qtr BHD 9.654
>Qtr DKK 0.717
>please show me how i will write recordset to convert Excel sheet
>thanks
>


No code is needed, or even appropriate. Instead you can use a "Normalizing
Union Query".

Use File... Get External Data... Link to link to your table (well, you can use
code using the TransferSpreadsheet method if that's more convenient). Have
your target tblCurrency already defined. Create a UNION query based on the
linked spreadsheet:

SELECT "Kwt" AS COuntry, [Code], [Kwt] AS RATE
FROM linkedspreadsheet
UNION ALL
SELECT "Bhn", [Code], [BHN]
FROM linkedspreadsheet
UNION ALL
SELECT "Qtr", [Code], [Qtr]
FROM linkedspreadsheet;

Add more select clauses if you have more countries.

Base an Append query on this Union query and run it to append the data into
your table.
--

John W. Vinson [MVP]
 
Reply With Quote
 
Wahab
Guest
Posts: n/a
 
      8th Sep 2008


"John W. Vinson" wrote:

> On Sun, 7 Sep 2008 00:50:06 -0700, Wahab <(E-Mail Removed)>
> wrote:
>
> >Hi
> >Pls. help me to convert my Excel sheet into access Table by writing
> >recordset. Sheet is some how like this:
> >Code Kwt Bhn Qtr
> >USD 0.268 0.377 3.643
> >BHD 0.710 1.000 9.654
> >DKK 0.053 0.073 0.717
> >I want to convert with access table (TblCurrency) in this way:
> >Country Code Rate
> >Kwt USD 0.268
> >Kwt BHD 0.710
> >Kwt DKK 0.053
> >Bhn USD 0.377
> >Bhn BHD 1.000
> >Bhn DKK 0.073
> >Qtr USD 3.643
> >Qtr BHD 9.654
> >Qtr DKK 0.717
> >please show me how i will write recordset to convert Excel sheet
> >thanks
> >

>
> No code is needed, or even appropriate. Instead you can use a "Normalizing
> Union Query".
>
> Use File... Get External Data... Link to link to your table (well, you can use
> code using the TransferSpreadsheet method if that's more convenient). Have
> your target tblCurrency already defined. Create a UNION query based on the
> linked spreadsheet:
>
> SELECT "Kwt" AS COuntry, [Code], [Kwt] AS RATE
> FROM linkedspreadsheet
> UNION ALL
> SELECT "Bhn", [Code], [BHN]
> FROM linkedspreadsheet
> UNION ALL
> SELECT "Qtr", [Code], [Qtr]
> FROM linkedspreadsheet;
>
> Add more select clauses if you have more countries.
>
> Base an Append query on this Union query and run it to append the data into
> your table.
> --
>
> John W. Vinson [MVP]
>

Thanks Mr.John
This will not solve my problem, sometime countries are increasing or
decreasing and I have more than 110 countries and currencies and want to
compare the monthly rate form past and current month and feed in system with
correct decimals, slight mistake in entry gives hell of difference. My idea
is to compare both tables and mark only fields which rates are changed, so I
can enter those rates only and minimise the entry mistakes.
For this reason I need to write code which will make my job automatically. I
appreciate if someone will give me how to write codes.
Thanks and regards


 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      8th Sep 2008
On Mon, 8 Sep 2008 00:11:01 -0700, Wahab <(E-Mail Removed)>
wrote:

>This will not solve my problem, sometime countries are increasing or
>decreasing and I have more than 110 countries and currencies and want to
>compare the monthly rate form past and current month and feed in system with
>correct decimals, slight mistake in entry gives hell of difference. My idea
>is to compare both tables and mark only fields which rates are changed, so I
>can enter those rates only and minimise the entry mistakes.
>For this reason I need to write code which will make my job automatically. I
>appreciate if someone will give me how to write codes.
>Thanks and regards


Well, it would have helped to say so.

You can still link to the spreadsheet and write VBA code to loop through its
Fields collection and construct SQL, or open a recordset based on your actual
table. Perhaps you should start a new thread posting these additional
requirements and the structure of your Access table, so that someone else
could jump in.
--

John W. Vinson [MVP]
 
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
excel 2007 convert one sheet into multiples sheets (for excel 2003Compatibility) recif20002002@yahoo.fr Microsoft Excel Programming 2 17th Jul 2009 10:33 AM
Convert Excel sheet to PDF Fable Microsoft Excel Programming 2 4th Jun 2005 12:11 AM
How to convert the table in word to excel sheet? =?Utf-8?B?U2FudGhvc2g=?= Microsoft Excel Misc 1 2nd Dec 2004 10:15 AM
Convert Excel sheet to Database? Jim Clark Microsoft Excel Misc 2 7th Apr 2004 12:44 PM
How would I convert the following into a excel sheet? Phillips Microsoft Excel Programming 1 25th Nov 2003 08:15 PM


Features
 

Advertising
 

Newsgroups
 


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