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 
Looping through form controls
Scott 

15 years ago
Alex you are a genious. I did some playing based on the information that you posted. Here is the code:
Private Sub Form_Load()
Dim firsthour As Integer
Dim consumedhours As Integer
Dim firstunithour As Integer
Dim UHU As Integer
Dim ctl As Control
Dim i As Integer

DoCmd.OpenQuery "qryTaskTime"
DoCmd.OpenForm "frmUnitHours", acNormal, , , acFormAdd
DoCmd.GoToRecord acDataForm, "frmUnitHours", acNewRec
Forms![frmUnitHours]![DOS].Value = DLookup("ScheduledDate", "qryTaskTime", "PCNumber=" & Forms![frmUnChargedUnitHours]![PCNumber])
firstunithour = DLookup("firstHour", "qryTaskTime", "PCNumber=" & Forms![frmUnChargedUnitHours]![PCNumber])
UHU = DLookup("ConsumedUnitHours", "qryTaskTime", "PCNumber=" & Forms![frmUnChargedUnitHours]![PCNumber])


Dim time As Integer
time = firstunithour
Dim hours As Integer
hours = UHU
For i = firstunithour To (firstunithour + UHU)
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
        If ctl.Name = "hr" & i Then
        ctl.Value = 1
        End If
    End If
    Next ctl
Next i
End Sub

Couldnt have done it without you. The good news is that I have it completely automated, it ran through 250+ records in about a minute while I was playing army attack on facebook.

Now on to the graphs.

cant thank you enough

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/18/2026 12:42:02 PM. PLT: 0s