Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

Access Question
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   3/27/2008 3:54:54 PM
Here's a really good Access question someone sent me. I've been meaning to cover this in my classes, and it will be in a future lesson:

hi richard,
i searched the index of courses on your website but didn't find this...

i've built a database from scratch for our department. i need a form for entering scores achieved on a certain assessment. the table for this data includes the following fields:

recordID (autonumber)

each candidate will always have [say] 10 records, one for each of the components in the assessment. can i create a form that will have 10 records, each one pre-filled with one of the assessment components? and then the user can just put in the score for each component? this form would function as a subform along with other like subforms, all on a form with the candidate's name at the top.

thanks for any help you can give me.

You're right - I haven't covered this in any of my classes yet. I plan to very soon. There are 3 ways I can think of to handle this situation:

1. A recordset
2. DoCmd.RunSQL and an INSERT statement
3. Cheezy GotoRecord commands

The first would be the best choice - open up a recordset and programmatically insert the records into your table, then refresh the subform to display them. This is also the hardest to code.

The second choice would involve a loop and an INSERT query to do the same thing. Also some coding - but not as hard.

The third choice is probably the easiest to accomplish without as much advanced coding. Basically the pseudocode would be:

' DoCmd.GotoControl "Subform" ' the name of your subform
' For X = 1 to 10 ' or however many you need
' DoCmd.GotoRecord ... acNewRec ' go to a new record
' strCandidate = Forms!MainForm!Candidate
' strScorer = Forms!MainForm!Scorer
' etc.
' Next X

This will leave you with the pre-filled in fields that you want. It's a bit cheezy of a solution, but it should work. You'll need to look up the exact syntax for the GoToRecord command - there are some other parameters needed in there, but that should get you started.

I've been wanting to do something like this in my class database. The example I was going to use was pre-filling a table with a customer's payments. Let's say you owe $1000 and you want to schedule 10 monthly payments of $100. The database could automatically fill them into the payment table at scheduled dates. You could also use this for loan amortization schedules.

Permanent Link
Keywords: access

Add Your Comments or Subscribe
If you just want to subscribe to get email updates when the News is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 4+6:
  Notify me when the News is updated.
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



You may want to read these articles from the 599CD News:

4/4/2020Access Concatenation
3/30/2020Access DateDiff Function
3/23/2020Browsing and Selecting Files
3/14/2020New Access Group
3/6/2020NEW Access 2019 for Beginners
8/15/2019Last Chance for Access CDs
8/1/2019Customer List Form Template
8/1/2019New Template Access Customer Database
7/30/2019Microsoft Access Developer 13
6/20/2019TIP: Validation Rules in Access

Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed   
Richard Rost Microsoft MVP