Hai. I have student marks in excel sheet. I need to export this data in to msaccess. I have no problem in exporting the data. My excel sheet is in this format
I have 40 students. Each student had attended 9 tests which has 5 criteria, under which marks had been given(10).
one sample data is
B0841 Albert Raja A.
0 0 0 0 0
0 0 0 0 0.5
2 2 0 0 1
0 0 0 0 0
0 0 0 0 0
2 1 1 1 0
2 1 1 1 0
1.5 1.5 1.5 1 0.5
2 1 1.5 1.5 1
This whole data is in one row. Now I want this to be exported in 9 rows, I have 5 columns, so student's regno will be repeated 9 times, but i want this marks to be entered in 9 rows for 9 tests.
How do I do that without modifying the structure of excel sheet.
7 2615
You could use a union query
I will assume that the spreadsheet imported into an access table called Sheet1 and has the spreadsheets column cell names as field names. ie A,B,C,D,E.........
I will assime the students regno is in column A and that the 5 columns of results are in sets B,C,D,E,F and G,H,I,J,K and L,M,N,O,P etc.
Here is the union query -
SELECT A,B,C,D,E,F FROM Sheet1
-
union all
-
SELECT A,G,H,I,J,K FROM Sheet1
-
union all
-
SELECT A,L,M,N,O,P FROM Sheet1
-
...keep repeating the unions
-
...until all 9 sets of 5 results are selected
-
I hope that helps
But I do not know how to use these query to get the records from excel to ms access
sorry, I thought you said
I need to export this data in to msaccess. I have no problem in exporting the data
Anyway, do this (I use access 2003)
Open access
Goto the tables pane
right click in a blank area and select "import" on the context menu
In the "Files of type" dropdown select "Microsoft Excel"
Navigate to the excel file and double click it.
Choose the sheet you want to import
Just keep selecting next untill the sheet is imported.
Now you have the sheet in access as a table.
All you need do is use the query above using the table you just imported
I get only 5 fields value in a row. I m not able to get all the values
even If i get value
How do I insert these records into another table
please help me
it is very urgent
Thanks in advance
I thought that was what you wanted, 9 rows of 5 values in each row?
This whole data is in one row. Now I want this to be exported in 9 rows, I have 5 columns, so student's regno will be repeated 9 times, but i want this marks to be entered in 9 rows for 9 tests.
Post your query and a better explanation what it is doing wrong
To insert into another table you can turn the finised query into an append query with the wizard
or you can write it manually
something like this -
INSERT INTO tblTheOtherTable
-
SELECT ID,A,B,C,D,E,F
-
FROM
-
( SELECT ID,A,B,C,D,E,F FROM Sheet1
-
union all
-
SELECT ID,A,G,H,I,J,K FROM Sheet1
-
union all
-
SELECT ID,A,L,M,N,O,P FROM Sheet1
-
) a
-
but that is pretty basic query writing, perhaps you should spend some time in some tutorials that covers access basics
I found the reason why I was not able to get all the data in msaccess
1. If I use union all I m not able to get but if I use UNION I m able to join
2. While importing the data from excel, there as an error in excel data
coz I had both string value and number value in my excel. coz of which data was not getting imported into db
3. What I have done is this. I left the headrow with string field and number field
and while importing I have checked the option first row as header
4. Without any error the data is imported and now when i use union i m able to get the record in 9 rows
thanks for guiding
NeoPa 32,556
Expert Mod 16PB
You seem to assume that UNION ALL must be the same as UNION. Shouldn't common-sense tell you that this is unlikely to be true? It isn't true.
You are likely to have problems with UNION as opposed to UNION ALL when you lose entries that just happen to contain the same set of values. As you've described it so far you have no indicator exported to indicate which test the record refers to. You are relying on the position of the record within the set. This will fail when records are dropped due to the misuse of the UNION phrase.
You really need to start by getting your requirements clearly understood in your own head first, then posting a sensible question (one that makes logical sense). From that point we can be far more helpful to you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matt |
last post by:
I have an ASP page that calls ASP routines that I created that execute
a database query and return the results to a recordset. I then iterate
through the recordset and display the data in a table....
|
by: Elena |
last post by:
I'm trying to export data to an Excel worksheet. I can export the data in
the cell values perfectly.
I need the code to change a header and footer for the worksheet, not for the
columns.
Is...
|
by: Jiro Hidaka |
last post by:
Hello,
I would like to know of a fast way to export data source data into an Excel
sheet.
I found a way from C# Corner(Query Tool to Excel using C# and .NET) which is
a neat little way of...
|
by: Hemant Sipahimalani |
last post by:
The following piece of code is being used to export HTML to excel.
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
|
by: JawzX01 |
last post by:
Hello All,
First, thank you for any help you can provide.
I'm trying to do a simple export to excel. I've used the classic
code that is all over the internet, and of course it worked without a...
|
by: smaczylo |
last post by:
Hello, I've recently been asked to work with Microsoft Access, and
while I feel quite comfortable with Excel, I'm at a complete loss with
databases. If someone could help me with this issue I'm...
|
by: CoolFactor |
last post by:
MY CODE IS NEAR THE BOTTOM
I want to export this Access query into Excel using a command button on an Access form in the following way I describe below.
Below you will find the simple query I am...
|
by: Merlin1857 |
last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can...
|
by: =?Utf-8?B?YzY3NjIyOA==?= |
last post by:
Hi all,
I have a question for you.
I have a .csv file which has many lines of data.
Each line has many data fields which are delimited by ",".
Now I need to extract part of data from this...
|
by: hemantbasva |
last post by:
Note We need to have a template on server for generating report in multiple sheet
as we do not had msoffice on server
moreover this require a batch job to delete excel file created by the...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |