473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to import data from MS Excel to MS Access QUERIES or FORMS instead of tables

I have school database with a table which contain the list of all subjects, Scores and grades. Because each teacher assess only one subject, I have created a query to separate the various subjects for the teachers so that each teacher would see only his subject in the form based on the query.

To make thing easier I want them to be able to upload an excel file for each subject.
Instead of importing into the main table, I want the import to be done into the query for each teacher. I am using this code but I realize data is not uploading into the query or form but when I tried using a table, it works perfectly.

Please can someone help me with how to import data from Excel to Access Query instead of Tables?

I can deal with the that of tables but am not getting success with the query or forms.

This is the code am using

Expand|Select|Wrap|Line Numbers
  1. strTable = "Form3C1Term1"
  2.  
  3. DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
  4.       strTable, strPathFile, blnHasFieldNames, "F1:F5"
Nov 29 '14 #1
1 1439
zmbd
5,501 Expert Mod 4TB
What you ask for is not that simple...

One would not normally do what you are describing with the data in a properly normalized table - and it really sounds as if your database isn't normalized at this point ( Please see: >> Database Normalization and Table Structures. )

The main issue with data import from excel is the data typing. All to often dates and numeric values are treated as text and that causes issues... if you will use the search box at the top of this page (orange with magnifying glass) and search on excel import to access you will get a ton of threads describing the various VBA and external data methods for importing. The docmd.transferspreadsheet is among those results.

Some terms:
Tables - where the data is stored
Queries - snapshots of the tables
Forms - used to manipulate the table data, can be used with queries
Reports - Even though they look like forms (and now can kind of act like them) are use to report the data either directly from the tables or more commonly from a query that pulls only the desired data
Normalization - a Method of segregating data so that data manipulation and reporting is usually more efficient.

I would be happy to send you a boilerplate with some tutorials and other reference links, just PM me

-z

(just a thought on your tables - and this is at 4am local, neighbor dog was barking went to go feed it and open its dog house door, the wind blows it shut (^_^) good dog, just noisy.)

tbl_teachernames
tbl_subjectnames
tbl_studentnames
tbl_schoolterms
tbl_termprogram
tbl_programeenrollment
tbl_ConvertfromLetter4Pt5ptTo100score
tbl_grades

(you might need other tables depending on your application... for this model I am only looking a final course grade for the indicated term)

SchoolTerms could be the year, or by quarter,etc...
TermProgram would link teachers to subject and the term
ProgrmEnrollment links the students to the termprogram
tbl_grades links the student enrolled in a termprogram and the grade received via the ProgramEnrollment table.

The ConvertfromLetter4Pt5ptTo100score table allow you to store the grade in the standard 100point scale while allowing teachers to assign grades by letter on either 4pt or 5pt scale. You can then re-assign cut off values without needed to recode the database

The form should be straight forward to design and the teacher should enter directly. Split the database and multiple teachers should be able to enter at the same time.

To import from speadsheet,
Use the file dialog (Select a File or Folder using the FileDialog Object) to allow the teacher to find excel file.
(personally I would use code to generate this file from the database in the proper format or you will be programing from now till the cows come home to handle each teacher's whim). Then use automation to read the data... ( Application Automation )
Nov 29 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
1
by: JMCN | last post by:
is it possible to have two tables as field source in a form? for instance i created a query that concatenates the comments fields from two tables (see below). i can easily create a subform however,...
2
by: connormurphy | last post by:
How do I import data from Access into an Oracle database? I'm looking at hetergeneous services but I was hoping to simply set up an ODBC connection and pull accross the data easily. But I cannot...
1
by: boris_amj | last post by:
Help, I have an Access database with link tables to a SQL Server 2000 database. When I run the following query, it works OK: SELECT Format(,"mmmm yyyy") AS DateTXT, Sum(='CANCELLED') AS...
11
by: MD | last post by:
Hello, I need to import a sheet of 884 different excel-file with same lay- out. The sheet name is 'Totaal' and is the same in all different files. Is there a script (module) in order to: 1....
0
by: bbeshlian | last post by:
I was given the code to intially develop an interface for a web based system I will eventually administer. I tested the code and I can write my SQL statements to retrieve and display the data I...
1
by: Scott.Ashby | last post by:
Everyone, I have a form which is bound to a table. There are about 10 fields on the form, and my users would like for all but 2 of the fields they enter on this form as part of a new record to...
1
by: Pauline | last post by:
Dear all, I have an enormous database (Access 2003) containing sales information, and an Excel tool to enable end users to do planning and forecasting. Untill now I would create several queries,...
11
by: Laurel Eppstein | last post by:
I have no hair left with this issue! I'm simply trying to import data from named ranges in Excel 2003, into tables of the same name in Access 2003. I have found that unless I have the spreadsheet...
0
by: ISSL | last post by:
Basically I have developed an Access 2007 system and it is working fine. Now I need to link Sage 50 to Access System in order to get daily invoicing and credit info from Access to Sage every morning....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.