Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Adding records in a subform
David 

11 years ago
Could I get a little more explanation on the response I received regarding automatically adding records in a subform based on the value in a combo box? I'm a beginner in VBA and need a little extra guidance. To reiterate, I have a service business and on the order form, the user can enter 1, 2, or 3 sessions. For each session we need a start time to be entered. Therefore I was thinking I'd probably want a subform on the order form with the number of records equal to the value that they chose in the number of sessions combo box (i.e. 1, 2, or 3). Then they can enter the start time for each session, and the remaining fields in the record (end time, staff prep time, etc.) will auto fill based on the start time entered.

If there is a better way to do this please let me know. I have gone through the Access tutorial videos through Expert 21 and have watched the Work Order and Calendar seminars as well.


Reply from Alex Hedley:

Do you know the original post? Get the Thread and post it in a reply.

You could have a button that loops for the number in the combo adding a new record.

Create your db and rs objects

For counter = 1 to cboChoice
    sql = "INSERT INTO table (Field1, Field2) VALUES (x, y)"
    DoCmd.RunSQL sql
Next counter

You'll want warnings off and close off your objects.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 2:00:48 AM. PLT: 1s