473,406 Members | 2,769 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,406 software developers and data experts.

Building a single form for multiple entries

I have a table that contains data for schools. THe table structure is as follows:

buildingid
gradeid
teacher_count
student_enroll
year

My question concerns the form used to add data. Right now I have a continuous form that requires the user to populate data for each grade using a combo box. For example, a school may have 20 grade classifications that the user has to pull from a combo to add the data. Is is possible to build a form that would have the grades listed on the form? Example when the user opens the form for School A all the possible grades are listed and the user indicates the counts for each grade.
Mar 8 '08 #1
5 1753
Stewart Ross
2,545 Expert Mod 2GB
Hi. Assuming you have a table called Building which contains details of your buildings, a table called Grades which defines the grades you mention, and that the table you list is called TeacherGradeCounts, you could use an SQL Insert query like this (changing the table names if these are not the same as yours):
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO teachergradecounts ( [year], buildingid, gradeid, teacher_count, student_enroll )
  2. SELECT [which year?] AS TheYear, building.buildingid, grade.gradeid, 0 AS teacher_count, 0 AS student_enroll
  3. FROM grade, building
  4. ORDER BY [which year?], building.buildingid, grade.gradeid;
This query has a parameter [which year?] which pops up a request for the year. User enters the year and the query populates the teachergradecounts table as shown below (with dummy values for bulding ID and grade):
Expand|Select|Wrap|Line Numbers
  1. year buildingid gradeid teacher_count student_enroll
  2. 2007 B1 G1 0 0
  3. 2007 B1 G2 0 0
  4. 2007 B1 G3 0 0
  5. 2007 B1 G4 0 0
  6. 2007 B1 G5 0 0
  7. 2007 B1 G6 0 0
  8. 2007 B1 G7 0 0
  9. 2007 B2 G1 0 0
  10. 2007 B2 G2 0 0
  11. 2007 B2 G3 0 0
  12. 2007 B2 G4 0 0
  13. 2007 B2 G5 0 0
  14. 2007 B2 G6 0 0
  15. 2007 B2 G7 0 0
  16. 2007 B3 G1 0 0
  17. 2007 B3 G2 0 0
  18. 2007 B3 G3 0 0
  19. 2007 B3 G4 0 0
  20. 2007 B3 G5 0 0
  21. 2007 B3 G6 0 0
  22. 2007 B3 G7 0 0
  23. ...
You could store the query under a suitable name then run the query when needed from a command button on your data entry form to populate the table. If your table is defined with the correct keys you can only run it once for any one year. Trying to run it again (without deleting all the rows that were put in the last time) would be rejected by Access as a result of trying to duplicate existing key values.

-Stewart
Mar 8 '08 #2
THanks Stuart. I will try it this weekend.

Patti
Mar 9 '08 #3
Stuart:

One question... In the grade table I have a field called school_level which indicates classes that pertain to a specific type of school, i.e. elementary, middle, and high. Can you show me how to adjust your query to make sure that the proper grades are pulled by building and school_level type. Otherwise I will have all grades for each school. THanks again for all your help.

Patti
Mar 9 '08 #4
Stewart Ross
2,545 Expert Mod 2GB
...I have a field called school_level which indicates classes that pertain to a specific type of school, i.e. elementary, middle, and high. Can you show me how to adjust your query to make sure that the proper grades are pulled by building and school_level type. Otherwise I will have all grades for each school. ...
Hi Patti. The most correct approach would be to add your school table to the query, but as I don't know what fields it has, or its relationship to the buildings table, the simplest approach would be to add a WHERE clause to select the correct type of school in response to another user-entered parameter, [school level?], like this:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO teachergradecounts ( [year], buildingid, gradeid, teacher_count, student_enroll )
  2. SELECT [which year?] AS TheYear, building.buildingid, grade.gradeid, 0 AS teacher_count, 0 AS student_enroll
  3. FROM grade, building
  4. WHERE grade.school_level = [school level?] 
  5. ORDER BY [which year?], building.buildingid, grade.gradeid;
-Stewart
Mar 9 '08 #5
It worked beautifully! Thank you for the timely lesson with SQL.

Patti
Mar 9 '08 #6

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

Similar topics

0
by: PatchFactory Support | last post by:
Description: Professional and easy-to-use patch building environment that can help you to create instant patch packages for software and file updating. Generated patch packages are small size...
1
by: ccr | last post by:
Please view in a text editor so that the columnar text lines up. I used Terminal 9pt font to compose this post and copied/pasted to my newsreader program. I am writing in the hope that one of...
1
by: ccr | last post by:
Reposted with a longer line length. Apologies if I did not cancel the 1st attempt before you got it. If necessary, please view in a text editor so the columnar text lines up. I used Terminal...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
8
by: JReneau35 | last post by:
I am a novice to MS Access. I have about 10 to 15 tables that link to a single form. I use unique ID's to link all of these tables together. Since the ID for the customer never changes, I was...
1
by: AMDRIT | last post by:
Occasionally I try my hand at a simple data storage engine. Today I ran across an article on the web http://msdn2.microsoft.com/en-us/library/aa289151(vs.71).aspx, and it got me thinking again. ...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
7
by: Birky | last post by:
Is there a way to have Access enter multiple entries to a database based on a form where the user has selected a certain criteria? I am hoping to have my form enter multiple entries within a table...
9
by: Jankie | last post by:
<?php if(isset($_POST) && $_FILES > 0){ foreach ($_FILES as $key => $error) { $name = $_FILES; $tempname = $_FILES; ………… ……… $path = 'uploads/'; include 'dbcon.php'; $rep = strpos($_FILES,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.